Support Questions

Find answers, ask questions, and share your expertise

Unit test: Reader returns empty records

avatar
Expert Contributor

Here is my unit test code:

runner.setProperty(....);
RecordSchema inputRecordSchema = ....create schema based on RecordField
final Object[] recordArray = recordArray(inputRecordSchema); // create records(instances of MapRecord)
parser.addRecord((Object) recordArray);

....
Object[] recordArray(RecordSchema schema){
Record record = new MapRecord(schema, new HashMap<String, Object> {
{
put(...)
...
...
}
}
.....
}

In main code, I iterate records from reader:

while((record = reader.nextRecord()) != null) {
         //process record
}

But I see that record, though MapRecord instance, is empty.

Seems I am missing some step in unit test.

How to sort it out?

0 REPLIES 0