Using TopologyTestDriver for testing Biconsumer

20 Views Asked by At

I have a biconsumer function that accepts 2 inputs and does some work with them

Class Sample implements Biconsumer<KStream<String,ClassA>, GlobalKTable<String,ClassB>>

I m trying to test this.

My test has

ConsumerRecord<byte[],byte[]> record1 = recordfactory.create(inputtopic1,"123", classA);

testDriver.pipeInput(record1);

ConsumerRecord<byte[],byte[]> record2 = recordfactory.create(inputtopic2,"123", classB);

testDriver.pipeInput(record2);

When the testDriver.pipeInput(record1) is called, it invokes the biconsumer but since the 2nd record is not piped in yet , it goes as null to the 2nd argument of the biconsumer..

How to make sure both test records are available when the biconsumer is called?

0

There are 0 best solutions below