Program: 8710
Project: 8710
Buggy source:
@Test public void test() throws Exception {
  IdService idService=new MapIdService();
  HTablePool pool=mock(HTablePool.class);
  HTableInterface htableInterface=mock(HTableInterface.class);
  when(pool.getTable(any(byte[].class))).thenReturn(htableInterface);
  when(htableInterface.batch(anyList())).thenAnswer(a -> {
    List<Row> arguments=(List<Row>)a.getArguments()[0];
    int size=arguments.size();
    Object[] objects=new Object[size];
    for (int i=0; i < size; ++i) {
      if (i % 2 == 1) {
        objects[i]=null;
      }
      objects[i]=new Result(new KeyValue[]{new KeyValue(arguments.get(i).getRow(),CF,HBaseDbHarness.QUALIFIER,Longs.toByteArray(10L))});
    }
    return objects;
  }
);
  HbaseDbHarnessConfiguration config=HbaseDbHarnessConfiguration.newBuilder().setBatchSize(100).setUniqueCubeName("String_Node_Str".getBytes()).setTableName(CUBE_DATA_TABLE).setCf(CF).setCommitType(DbHarness.CommitType.INCREMENT).build();
  DbHarness<LongOp> hbaseDbHarness=new HBaseDbHarness<LongOp>(config,pool,LongOp.DESERIALIZER,idService,(avoid) -> null);
  when(htableInterface.get(any(Get.class))).thenReturn(getResult(10L),getResult(10L),getResult(100L));
  DbHarnessTests.asyncBatchWritesTest(hbaseDbHarness,10);
  verify(htableInterface,atLeast(2)).batch(anyList());
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  IdService idService=new MapIdService();
  HTablePool pool=mock(HTablePool.class);
  HTableInterface htableInterface=mock(HTableInterface.class);
  final List<Increment> incrementOperations=new LinkedList<>();
  when(pool.getTable(any(byte[].class))).thenReturn(htableInterface);
  long value=10L;
  when(htableInterface.batch(anyList())).thenAnswer(a -> {
    List<Increment> arguments=(List<Increment>)a.getArguments()[0];
    int size=arguments.size();
    Object[] objects=new Object[size];
    for (int i=0; i < size; ++i) {
      incrementOperations.add(arguments.get(i));
      if (i % 2 == 1) {
        objects[i]=null;
      }
      objects[i]=new Result(new KeyValue[]{new KeyValue(arguments.get(i).getRow(),CF,HBaseDbHarness.QUALIFIER,Longs.toByteArray(value))});
    }
    return objects;
  }
);
  HbaseDbHarnessConfiguration config=HbaseDbHarnessConfiguration.newBuilder().setBatchSize(2).setUniqueCubeName(new byte[]{}).setTableName(CUBE_DATA_TABLE).setCf(CF).setCommitType(DbHarness.CommitType.INCREMENT).build();
  DbHarness<LongOp> hbaseDbHarness=new HBaseDbHarness<LongOp>(config,pool,LongOp.DESERIALIZER,idService,(avoid) -> null);
  when(htableInterface.get(any(Get.class))).thenReturn(getResult(value),getResult(value),getResult(100L));
  HourDayMonthBucketer hourDayMonthBucketer=new HourDayMonthBucketer();
  Dimension<DateTime> time=new Dimension<DateTime>("String_Node_Str",hourDayMonthBucketer,false,8);
  Dimension<String> zipcode=new Dimension<String>("String_Node_Str",new StringToBytesBucketer(),true,5);
  Rollup hourAndZipRollup=new Rollup(zipcode,time,HourDayMonthBucketer.hours);
  Rollup dayAndZipRollup=new Rollup(zipcode,time,HourDayMonthBucketer.days);
  Rollup hourRollup=new Rollup(time,HourDayMonthBucketer.hours);
  Rollup dayRollup=new Rollup(time,HourDayMonthBucketer.days);
  List<Dimension<?>> dimensions=ImmutableList.<Dimension<?>>of(time,zipcode);
  List<Rollup> rollups=ImmutableList.of(hourAndZipRollup,dayAndZipRollup,hourRollup,dayRollup);
  DataCube<LongOp> cube=new DataCube<LongOp>(dimensions,rollups);
  WriteBuilder writeBuilder=new WriteBuilder();
  Batch<LongOp> writes=cube.getWrites(writeBuilder.at(time,DateTime.now()).at(zipcode,"String_Node_Str"),new LongOp(10));
  hbaseDbHarness.runBatchAsync(writes,new AfterExecute<LongOp>(){
    @Override public void afterExecute(    Throwable t){
      throw new RuntimeException(t);
    }
  }
);
  hbaseDbHarness.shutdown();
  int size=writes.getMap().size();
  List<BoxedByteArray> result=incrementOperations.stream().map(Increment::getRow).sorted((a,b) -> Bytes.BYTES_COMPARATOR.compare(a,b)).map(BoxedByteArray::new).collect(Collectors.toList());
  List<BoxedByteArray> expected=writes.getMap().keySet().stream().map(a -> {
    try {
      return a.toWriteKey(idService);
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
).map(BoxedByteArray::new).sorted((a,b) -> Bytes.BYTES_COMPARATOR.compare(a.bytes,b.bytes)).collect(Collectors.toList());
  assertEquals(expected,result);
  assertEquals(incrementOperations.size(),size);
  verify(htableInterface,times(size / config.batchSize)).batch(anyList());
}