Program: 37692
Project: 37692
Buggy source:
/** 
 * We attempt to consume from the topic and get our expected messages. We ack the messages each as we get it, in order, one by one.
 */
@Test public void testSimpleConsumeFromTopicWithAckingInOrderOneByOne(){
  final int numberOfRecordsToProduce=5;
  final TopicPartition partition0=new TopicPartition(topicName,0);
  final List<ProducerRecord<byte[],byte[]>> producedRecords=produceRecords(numberOfRecordsToProduce);
  List<String> brokerHosts=Lists.newArrayList(kafkaTestServer.getKafkaServer().serverConfig().advertisedHostName() + "String_Node_Str" + kafkaTestServer.getKafkaServer().serverConfig().advertisedPort());
  SidelineConsumerConfig config=new SidelineConsumerConfig(brokerHosts,"String_Node_Str",topicName);
  config.setKafkaConsumerProperty("String_Node_Str","String_Node_Str");
  PersistenceManager persistenceManager=new InMemoryPersistenceManager();
  persistenceManager.open(Maps.newHashMap());
  SidelineConsumer sidelineConsumer=new SidelineConsumer(config,persistenceManager);
  sidelineConsumer.open(null);
  for (int x=0; x < numberOfRecordsToProduce; x++) {
    ConsumerRecord<byte[],byte[]> foundRecord=sidelineConsumer.nextRecord();
    assertNotNull(foundRecord);
    ProducerRecord<byte[],byte[]> expectedRecord=producedRecords.get(x);
    logger.info("String_Node_Str",expectedRecord.key(),foundRecord.key());
    assertEquals("String_Node_Str",new String(expectedRecord.key(),Charsets.UTF_8),new String(foundRecord.key(),Charsets.UTF_8));
    assertEquals("String_Node_Str",new String(expectedRecord.value(),Charsets.UTF_8),new String(foundRecord.value(),Charsets.UTF_8));
    sidelineConsumer.commitOffset(foundRecord);
    validateConsumerState(sidelineConsumer.flushConsumerState(),partition0,foundRecord.offset());
  }
  logger.info("String_Node_Str",sidelineConsumer.flushConsumerState());
  sidelineConsumer.close();
}

Fixed version (ground truth):
/** 
 * We attempt to consume from the topic and get our expected messages. We ack the messages each as we get it, in order, one by one.
 */
@Test public void testSimpleConsumeFromTopicWithAckingInOrderOneByOne(){
  final int numberOfRecordsToProduce=5;
  final TopicPartition partition0=new TopicPartition(topicName,0);
  final List<ProducerRecord<byte[],byte[]>> producedRecords=produceRecords(numberOfRecordsToProduce);
  List<String> brokerHosts=Lists.newArrayList(kafkaTestServer.getKafkaServer().serverConfig().advertisedHostName() + "String_Node_Str" + kafkaTestServer.getKafkaServer().serverConfig().advertisedPort());
  SidelineConsumerConfig config=new SidelineConsumerConfig(brokerHosts,"String_Node_Str",topicName);
  PersistenceManager persistenceManager=new InMemoryPersistenceManager();
  persistenceManager.open(Maps.newHashMap());
  SidelineConsumer sidelineConsumer=new SidelineConsumer(config,persistenceManager);
  sidelineConsumer.open(null);
  for (int x=0; x < numberOfRecordsToProduce; x++) {
    ConsumerRecord<byte[],byte[]> foundRecord=sidelineConsumer.nextRecord();
    assertNotNull(foundRecord);
    ProducerRecord<byte[],byte[]> expectedRecord=producedRecords.get(x);
    logger.info("String_Node_Str",expectedRecord.key(),foundRecord.key());
    assertEquals("String_Node_Str",new String(expectedRecord.key(),Charsets.UTF_8),new String(foundRecord.key(),Charsets.UTF_8));
    assertEquals("String_Node_Str",new String(expectedRecord.value(),Charsets.UTF_8),new String(foundRecord.value(),Charsets.UTF_8));
    sidelineConsumer.commitOffset(foundRecord);
    validateConsumerState(sidelineConsumer.flushConsumerState(),partition0,foundRecord.offset());
  }
  logger.info("String_Node_Str",sidelineConsumer.flushConsumerState());
  sidelineConsumer.close();
}