Program: 92955
Project: 92955
Buggy source:
@Test public void testConsumerMaxBytesResponse() throws InterruptedException, ExecutionException {
  final List<ConsumerRecord<byte[],byte[]>> referenceRecords=Arrays.<ConsumerRecord<byte[],byte[]>>asList(new BinaryConsumerRecord(null,new byte[512],0,0),new BinaryConsumerRecord(null,new byte[512],1,0),new BinaryConsumerRecord(null,new byte[512],2,0),new BinaryConsumerRecord(null,new byte[512],3,0));
  Map<Integer,List<ConsumerRecord<byte[],byte[]>>> referenceSchedule=new HashMap<Integer,List<ConsumerRecord<byte[],byte[]>>>();
  referenceSchedule.put(50,referenceRecords);
  Map<String,List<Map<Integer,List<ConsumerRecord<byte[],byte[]>>>>> schedules=new HashMap<String,List<Map<Integer,List<ConsumerRecord<byte[],byte[]>>>>>();
  schedules.put(topicName,Arrays.asList(referenceSchedule));
  expectCreate(schedules);
  EasyMock.expect(mdObserver.topicExists(topicName)).andReturn(true);
  EasyMock.expect(mdObserver.topicExists(topicName)).andReturn(true);
  EasyMock.replay(mdObserver,consumerFactory);
  String cid=consumerManager.createConsumer(groupName,new ConsumerInstanceConfig(EmbeddedFormat.BINARY));
  sawCallback=false;
  actualException=null;
  actualLength=0;
  consumerManager.readTopic(groupName,cid,topicName,BinaryConsumerState.class,Long.MAX_VALUE,new ConsumerManager.ReadCallback<byte[],byte[]>(){
    @Override public void onCompletion(    List<? extends ConsumerRecord<byte[],byte[]>> records,    Exception e){
      sawCallback=true;
      actualException=e;
      actualLength=records.size();
    }
  }
).get();
  assertTrue("String_Node_Str",sawCallback);
  assertNull("String_Node_Str",actualException);
  assertEquals("String_Node_Str",2,actualLength);
  sawCallback=false;
  actualException=null;
  actualLength=0;
  consumerManager.readTopic(groupName,cid,topicName,BinaryConsumerState.class,512,new ConsumerManager.ReadCallback<byte[],byte[]>(){
    @Override public void onCompletion(    List<? extends ConsumerRecord<byte[],byte[]>> records,    Exception e){
      sawCallback=true;
      actualException=e;
      actualLength=records.size();
    }
  }
).get();
  assertTrue("String_Node_Str",sawCallback);
  assertNull("String_Node_Str",actualException);
  assertEquals("String_Node_Str",1,actualLength);
  consumerManager.deleteConsumer(groupName,cid);
  EasyMock.verify(mdObserver,consumerFactory);
}

Fixed version (ground truth):
@Test public void testConsumerMaxBytesResponse() throws InterruptedException, ExecutionException {
  final List<ConsumerRecord<byte[],byte[]>> referenceRecords=Arrays.<ConsumerRecord<byte[],byte[]>>asList(new BinaryConsumerRecord(null,new byte[511],0,0),new BinaryConsumerRecord(null,new byte[511],1,0),new BinaryConsumerRecord(null,new byte[511],2,0),new BinaryConsumerRecord(null,new byte[511],3,0));
  Map<Integer,List<ConsumerRecord<byte[],byte[]>>> referenceSchedule=new HashMap<Integer,List<ConsumerRecord<byte[],byte[]>>>();
  referenceSchedule.put(50,referenceRecords);
  Map<String,List<Map<Integer,List<ConsumerRecord<byte[],byte[]>>>>> schedules=new HashMap<String,List<Map<Integer,List<ConsumerRecord<byte[],byte[]>>>>>();
  schedules.put(topicName,Arrays.asList(referenceSchedule));
  expectCreate(schedules);
  EasyMock.expect(mdObserver.topicExists(topicName)).andReturn(true);
  EasyMock.expect(mdObserver.topicExists(topicName)).andReturn(true);
  EasyMock.replay(mdObserver,consumerFactory);
  String cid=consumerManager.createConsumer(groupName,new ConsumerInstanceConfig(EmbeddedFormat.BINARY));
  sawCallback=false;
  actualException=null;
  actualLength=0;
  consumerManager.readTopic(groupName,cid,topicName,BinaryConsumerState.class,Long.MAX_VALUE,new ConsumerManager.ReadCallback<byte[],byte[]>(){
    @Override public void onCompletion(    List<? extends ConsumerRecord<byte[],byte[]>> records,    Exception e){
      sawCallback=true;
      actualException=e;
      actualLength=records.size();
    }
  }
).get();
  assertTrue("String_Node_Str",sawCallback);
  assertNull("String_Node_Str",actualException);
  assertEquals("String_Node_Str",2,actualLength);
  String msg="String_Node_Str" + Long.toString(config.getTime().milliseconds()) + "String_Node_Str"+ Integer.toString(config.getInt(KafkaRestConfig.CONSUMER_REQUEST_TIMEOUT_MS_CONFIG) + config.getInt(KafkaRestConfig.CONSUMER_ITERATOR_TIMEOUT_MS_CONFIG));
  assertFalse(msg,config.getInt(KafkaRestConfig.CONSUMER_REQUEST_TIMEOUT_MS_CONFIG) + config.getInt(KafkaRestConfig.CONSUMER_ITERATOR_TIMEOUT_MS_CONFIG) < config.getTime().milliseconds());
  sawCallback=false;
  actualException=null;
  actualLength=0;
  consumerManager.readTopic(groupName,cid,topicName,BinaryConsumerState.class,512,new ConsumerManager.ReadCallback<byte[],byte[]>(){
    @Override public void onCompletion(    List<? extends ConsumerRecord<byte[],byte[]>> records,    Exception e){
      sawCallback=true;
      actualException=e;
      actualLength=records.size();
    }
  }
).get();
  assertTrue("String_Node_Str",sawCallback);
  assertNull("String_Node_Str",actualException);
  assertEquals("String_Node_Str",1,actualLength);
  consumerManager.deleteConsumer(groupName,cid);
  EasyMock.verify(mdObserver,consumerFactory);
}