Program: 6246
Project: 6246
Buggy source:
@Test public void testInternalsNotLeaking(){
  InMemoryTableService.create("String_Node_Str");
  NavigableMap<byte[],NavigableMap<byte[],Update>> updates=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  NavigableMap<byte[],Update> rowUpdate=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  byte[] rowParam=new byte[]{1};
  byte[] columnParam=new byte[]{2};
  byte[] valParam=new byte[]{3};
  rowUpdate.put(columnParam,new PutValue(valParam));
  updates.put(rowParam,rowUpdate);
  InMemoryTableService.merge("String_Node_Str",updates,1L);
  verify123();
  updates.remove(rowParam);
  rowUpdate.remove(columnParam);
  rowParam[0]++;
  columnParam[0]++;
  valParam[0]++;
  verify123();
  NavigableMap<byte[],NavigableMap<Long,byte[]>> rowFromGet=InMemoryTableService.get("String_Node_Str",new byte[]{1},1L);
  Assert.assertEquals(1,rowFromGet.size());
  byte[] columnFromGet=rowFromGet.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{2},columnFromGet);
  byte[] valFromGet=rowFromGet.firstEntry().getValue().get(1L);
  Assert.assertArrayEquals(new byte[]{3},valFromGet);
  rowFromGet.firstEntry().getValue().remove(1L);
  rowFromGet.remove(columnFromGet);
  columnFromGet[0]++;
  valFromGet[0]++;
  verify123();
  NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>> fromGetRange=InMemoryTableService.getRowRange("String_Node_Str",null,null,1L);
  Assert.assertEquals(1,fromGetRange.size());
  byte[] keyFromGetRange=fromGetRange.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{1},keyFromGetRange);
  NavigableMap<byte[],NavigableMap<Long,byte[]>> rowFromGetRange=fromGetRange.get(new byte[]{1});
  Assert.assertEquals(1,rowFromGetRange.size());
  byte[] columnFromGetRange=rowFromGetRange.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{2},columnFromGetRange);
  byte[] valFromGetRange=rowFromGetRange.firstEntry().getValue().get(1L);
  Assert.assertArrayEquals(new byte[]{3},valFromGetRange);
  rowFromGetRange.firstEntry().getValue().remove(1L);
  rowFromGetRange.remove(columnFromGetRange);
  fromGetRange.remove(keyFromGetRange);
  keyFromGetRange[0]++;
  columnFromGetRange[0]++;
  valFromGet[0]++;
  verify123();
}

Fixed version (ground truth):
@Test public void testInternalsNotLeaking(){
  InMemoryTableService.create("String_Node_Str");
  NavigableMap<byte[],NavigableMap<byte[],Update>> updates=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  NavigableMap<byte[],Update> rowUpdate=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  byte[] rowParam=new byte[]{1};
  byte[] columnParam=new byte[]{2};
  byte[] valParam=new byte[]{3};
  rowUpdate.put(columnParam,new PutValue(valParam));
  updates.put(rowParam,rowUpdate);
  InMemoryTableService.merge("String_Node_Str",updates,1L);
  verify123();
  updates.remove(rowParam);
  rowUpdate.remove(columnParam);
  rowParam[0]++;
  columnParam[0]++;
  valParam[0]++;
  verify123();
  NavigableMap<byte[],NavigableMap<Long,byte[]>> rowFromGet=InMemoryTableService.get("String_Node_Str",new byte[]{1},new Transaction(1L,2L,new long[0],new long[0],1L));
  Assert.assertEquals(1,rowFromGet.size());
  byte[] columnFromGet=rowFromGet.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{2},columnFromGet);
  byte[] valFromGet=rowFromGet.firstEntry().getValue().get(1L);
  Assert.assertArrayEquals(new byte[]{3},valFromGet);
  rowFromGet.firstEntry().getValue().remove(1L);
  rowFromGet.remove(columnFromGet);
  columnFromGet[0]++;
  valFromGet[0]++;
  verify123();
  NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>> fromGetRange=InMemoryTableService.getRowRange("String_Node_Str",null,null,new Transaction(1L,2L,new long[0],new long[0],1L));
  Assert.assertEquals(1,fromGetRange.size());
  byte[] keyFromGetRange=fromGetRange.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{1},keyFromGetRange);
  NavigableMap<byte[],NavigableMap<Long,byte[]>> rowFromGetRange=fromGetRange.get(new byte[]{1});
  Assert.assertEquals(1,rowFromGetRange.size());
  byte[] columnFromGetRange=rowFromGetRange.firstEntry().getKey();
  Assert.assertArrayEquals(new byte[]{2},columnFromGetRange);
  byte[] valFromGetRange=rowFromGetRange.firstEntry().getValue().get(1L);
  Assert.assertArrayEquals(new byte[]{3},valFromGetRange);
  rowFromGetRange.firstEntry().getValue().remove(1L);
  rowFromGetRange.remove(columnFromGetRange);
  fromGetRange.remove(keyFromGetRange);
  keyFromGetRange[0]++;
  columnFromGetRange[0]++;
  valFromGet[0]++;
  verify123();
}