Program: 63130
Project: 63130
Buggy source:
@Test(expected=IllegalStateException.class) public void testInvalidAppend() throws ParseException, IOException {
  CubeDescManager cubeDescMgr=getCubeDescManager();
  CubeDesc desc=cubeDescMgr.getCubeDesc("String_Node_Str");
  createNewCube(desc);
  SimpleDateFormat f=new SimpleDateFormat("String_Node_Str");
  f.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  long dateEnd=f.parse("String_Node_Str").getTime();
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(0,cubeInstance.getSegments().size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  CubeSegment initialSegment=cubeMgr.appendSegments(cubeInstance,desc.getCubePartitionDesc().getPartitionDateStart(),dateEnd);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  long dateEnd2=f.parse("String_Node_Str").getTime();
  cubeMgr.appendSegments(cubeInstance,dateEnd + 1000,dateEnd2);
}

Fixed version (ground truth):
@Test(expected=IllegalStateException.class) public void testInvalidAppend() throws ParseException, IOException {
  CubeDescManager cubeDescMgr=getCubeDescManager();
  CubeDesc desc=cubeDescMgr.getCubeDesc("String_Node_Str");
  createNewCube(desc);
  SimpleDateFormat f=new SimpleDateFormat("String_Node_Str");
  f.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  long dateEnd=f.parse("String_Node_Str").getTime();
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(0,cubeInstance.getSegments().size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  CubeSegment initialSegment=cubeMgr.appendSegments(cubeInstance,dateEnd);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  long dateEnd2=f.parse("String_Node_Str").getTime();
  cubeMgr.appendSegments(cubeInstance,dateEnd2);
}