Source:
void runTestWithDriver(final TestRecord<Long, String> expectedFinalResult, final String storeName) throws InterruptedException { try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(STREAMS_CONFIG), STREAMS_CONFIG)) { final TestInputTopic<Long, String> right = driver.createInputTopic(INPUT_TOPIC_RIGHT, new LongSerializer(), new StringSerializer()); final TestInputTopic<Long, String> left = driver.createInputTopic(INPUT_TOPIC_LEFT, new LongSerializer(), new StringSerializer()); final TestOutputTopic<Long, String> outputTopic = driver.createOutputTopic(OUTPUT_TOPIC, new LongDeserializer(), new StringDeserializer()); final Map<String, TestInputTopic<Long, String>> testInputTopicMap = new HashMap<>(); testInputTopicMap.put(INPUT_TOPIC_RIGHT, right); testInputTopicMap.put(INPUT_TOPIC_LEFT, left); final long firstTimestamp = System.currentTimeMillis(); long ts = firstTimestamp; for (final Input<String> singleInputRecord : input) { testInputTopicMap.get(singleInputRecord.topic).pipeInput(singleInputRecord.record.key, singleInputRecord.record.value, ++ts); } final TestRecord<Long, String> updatedExpectedFinalResult = new TestRecord<Long, String>( expectedFinalResult.key(), expectedFinalResult.value(), null, firstTimestamp + expectedFinalResult.timestamp()); TestUtils.waitForCondition(() -> finalResultReached.get(), "Never received expected final result."); final List<TestRecord<Long, String>> output = outputTopic.readRecordsToList(); assertEquals(output.get(output.size() - 1), updatedExpectedFinalResult); if (storeName != null) { checkQueryableStore(storeName, updatedExpectedFinalResult, driver); } } }

Target:
void runTestWithDriver(final TestRecord<Long, String> expectedFinalResult, final String storeName) throws InterruptedException { try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(STREAMS_CONFIG), STREAMS_CONFIG)) { final TestInputTopic<Long, String> right = driver.createInputTopic(INPUT_TOPIC_RIGHT, new LongSerializer(), new StringSerializer()); final TestInputTopic<Long, String> left = driver.createInputTopic(INPUT_TOPIC_LEFT, new LongSerializer(), new StringSerializer()); final TestOutputTopic<Long, String> outputTopic = driver.createOutputTopic(OUTPUT_TOPIC, new LongDeserializer(), new StringDeserializer()); final Map<String, TestInputTopic<Long, String>> testInputTopicMap = new HashMap<>(); testInputTopicMap.put(INPUT_TOPIC_RIGHT, right); testInputTopicMap.put(INPUT_TOPIC_LEFT, left); final long firstTimestamp = time.milliseconds(); long eventTimestamp = firstTimestamp; for (final Input<String> singleInputRecord : input) { testInputTopicMap.get(singleInputRecord.topic).pipeInput(singleInputRecord.record.key, singleInputRecord.record.value, ++eventTimestamp); } final TestRecord<Long, String> updatedExpectedFinalResult = new TestRecord<Long, String>( expectedFinalResult.key(), expectedFinalResult.value(), null, firstTimestamp + expectedFinalResult.timestamp()); final List<TestRecord<Long, String>> output = outputTopic.readRecordsToList(); assertThat(output.get(output.size() - 1), equalTo(updatedExpectedFinalResult)); if (storeName != null) { checkQueryableStore(storeName, updatedExpectedFinalResult, driver); } } }