Potential Unit test fix

This commit is contained in:
Chunxue Yang 2019-11-07 13:52:00 -08:00
parent 653a25456c
commit d940f8e2aa

View file

@ -329,6 +329,7 @@ public class ShardConsumerSubscriberTest {
List<ProcessRecordsInput> received = new ArrayList<>();
doAnswer(a -> {
ProcessRecordsInput input = a.getArgumentAt(0, ProcessRecordsInput.class);
log.info("Handling input for: {}", input.toString());
received.add(input);
if (input.records().stream().anyMatch(r -> StringUtils.startsWith(r.partitionKey(), TERMINAL_MARKER))) {
synchronized (processedNotifier) {
@ -364,7 +365,7 @@ public class ShardConsumerSubscriberTest {
}
// Verify that shardConsumer mock was called 100 times and all 100 input records are processed.
verify(shardConsumer, times(100)).handleInput(argThat(eqProcessRecordsInput(processRecordsInput)),
verify(shardConsumer, times(100)).handleInput(any(ProcessRecordsInput.class),
any(Subscription.class));
log.info("Verified that handleInput was called 100 times");