Source:
<code>public void testNextTupleEmitsFailedMessagesEvenWhenMaxUncommittedOffsetsIsExceeded() throws IOException { try (SimulatedTime simulatedTime = new SimulatedTime()) { KafkaSpout<String, String> spout = SpoutWithMockedConsumerSetupHelper.setupSpout(spoutConfig, conf, contextMock, collectorMock, consumerMock, partition); Map<TopicPartition, List<ConsumerRecord<String, String>>> records = new HashMap<>(); int numRecords = spoutConfig.getMaxUncommittedOffsets(); records.put(partition, SpoutWithMockedConsumerSetupHelper.<String, String>createRecords(partition, 0, numRecords)); when(consumerMock.poll(anyLong())) .thenReturn(new ConsumerRecords<>(records)); <START> OffsetAndMetadataStub.committed(consumerMock); <END> for (int i = 0; i < numRecords; i++) { spout.nextTuple(); } ArgumentCaptor<KafkaSpoutMessageId> messageIds = ArgumentCaptor.forClass(KafkaSpoutMessageId.class); verify(collectorMock, times(numRecords)).emit(anyString(), anyList(), messageIds.capture()); for (KafkaSpoutMessageId messageId : messageIds.getAllValues()) { spout.fail(messageId); } reset(collectorMock); Time.advanceTime(50); for (int i = 0; i < numRecords; i++) { spout.nextTuple(); } ArgumentCaptor<KafkaSpoutMessageId> retryMessageIds = ArgumentCaptor.forClass(KafkaSpoutMessageId.class); verify(collectorMock, times(numRecords)).emit(anyString(), anyList(), retryMessageIds.capture()); List<Long> failedOffsets = new ArrayList<>(); for (KafkaSpoutMessageId msgId : messageIds.getAllValues()) { failedOffsets.add(msgId.offset()); } InOrder inOrder = inOrder(consumerMock); inOrder.verify(consumerMock).seek(partition, failedOffsets.get(0)); inOrder.verify(consumerMock).poll(anyLong()); } }</code><technical_language>I checking out branch running test this line. pass. get rid of (and OffsetAndMetadataStub)</technical_language>

Target:
public void testNextTupleEmitsFailedMessagesEvenWhenMaxUncommittedOffsetsIsExceeded() throws IOException { try (SimulatedTime simulatedTime = new SimulatedTime()) { KafkaSpout<String, String> spout = SpoutWithMockedConsumerSetupHelper.setupSpout(spoutConfig, conf, contextMock, collectorMock, consumerMock, partition); Map<TopicPartition, List<ConsumerRecord<String, String>>> records = new HashMap<>(); int numRecords = spoutConfig.getMaxUncommittedOffsets(); records.put(partition, SpoutWithMockedConsumerSetupHelper.<String, String>createRecords(partition, 0, numRecords)); when(consumerMock.poll(anyLong())) .thenReturn(new ConsumerRecords<>(records)); for (int i = 0; i < numRecords; i++) { spout.nextTuple(); } ArgumentCaptor<KafkaSpoutMessageId> messageIds = ArgumentCaptor.forClass(KafkaSpoutMessageId.class); verify(collectorMock, times(numRecords)).emit(anyString(), anyList(), messageIds.capture()); for (KafkaSpoutMessageId messageId : messageIds.getAllValues()) { spout.fail(messageId); } reset(collectorMock); Time.advanceTime(50); for (int i = 0; i < numRecords; i++) { spout.nextTuple(); } ArgumentCaptor<KafkaSpoutMessageId> retryMessageIds = ArgumentCaptor.forClass(KafkaSpoutMessageId.class); verify(collectorMock, times(numRecords)).emit(anyString(), anyList(), retryMessageIds.capture()); List<Long> failedOffsets = new ArrayList<>(); for (KafkaSpoutMessageId msgId : messageIds.getAllValues()) { failedOffsets.add(msgId.offset()); } InOrder inOrder = inOrder(consumerMock); inOrder.verify(consumerMock).seek(partition, failedOffsets.get(0)); inOrder.verify(consumerMock).poll(anyLong()); } }