Program: 63133
Project: 63133
Buggy source:
@Test public void testRebuildSegment() throws IOException {
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  System.out.println("String_Node_Str");
  CubeSegment rebuildSegment=cubeMgr.appendSegments(cubeInstance,1364688000000L,1386806400000L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getRebuildingSegments().size());
  assertEquals(1364688000000L,cubeInstance.getAllocatedStartDate());
  assertEquals(1386806400000L,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,rebuildSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111,222,333);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(1364688000000L,cubeInstance.getAllocatedStartDate());
  assertEquals(1386806400000L,cubeInstance.getAllocatedEndDate());
  assertEquals("String_Node_Str",cubeInstance.getSegments().get(0).getLastBuildJobID());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
}

Fixed version (ground truth):
@Test public void testRebuildSegment() throws IOException {
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  System.out.println("String_Node_Str");
  CubeSegment rebuildSegment=cubeMgr.appendSegments(cubeInstance,1386806400000L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getRebuildingSegments().size());
  assertEquals(1364688000000L,cubeInstance.getAllocatedStartDate());
  assertEquals(1386806400000L,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,rebuildSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111,222,333);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(1364688000000L,cubeInstance.getAllocatedStartDate());
  assertEquals(1386806400000L,cubeInstance.getAllocatedEndDate());
  assertEquals("String_Node_Str",cubeInstance.getSegments().get(0).getLastBuildJobID());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
}