Program: 133536
Project: 133536
Buggy source:
/** 
 * Checks that exceptions are properly handled by  {@link PlotGridComposite#addPlot(IPlot)}.
 */
@Test public void checkAddPlotExceptions(){
  FakePlot fakePlot;
  IPlot plot;
  final IPlot nullPlot=null;
  final AtomicReference<Exception> eRef=new AtomicReference<Exception>();
  plot=nullPlot;
  try {
    assertEquals(-1,addPlot(plot));
  }
 catch (  Exception e) {
    fail("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  fakePlot=new FakePlot(){
    @Override public List<ISeries> getAllDependentSeries(    String category){
      return null;
    }
  }
;
  plot=fakePlot;
  try {
    assertEquals(-1,addPlot(plot));
  }
 catch (  Exception e) {
    fail("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  assertEquals(0,fakePlot.getDrawCount());
  fakePlot=new FakePlot();
  plot=fakePlot;
  try {
    assertEquals(-1,addPlot(plot));
  }
 catch (  Exception e) {
    fail("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  assertEquals(0,fakePlot.getDrawCount());
  fakePlot=new FakePlot(){
    @Override public Composite draw(    Composite parent) throws Exception {
      super.draw(parent);
      Exception e=new Exception("String_Node_Str");
      eRef.set(e);
      throw e;
    }
  }
;
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  plot=fakePlot;
  try {
    addPlot(plot);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  Exception e) {
    assertSame(eRef.get(),e);
  }
  assertEquals(1,fakePlot.getDrawCount());
  assertTrue(fakePlot.children.get(0).isDisposed());
  return;
}

Fixed version (ground truth):
/** 
 * Checks that exceptions are properly handled by  {@link PlotGridComposite#addPlot(IPlot)}.
 */
@Test public void checkAddPlotExceptions(){
  FakePlot fakePlot;
  IPlot plot;
  final IPlot nullPlot=null;
  final AtomicReference<Exception> eRef=new AtomicReference<Exception>();
  plot=nullPlot;
  try {
    assertEquals(-1,addPlot(plot));
  }
 catch (  Exception e) {
    fail("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  fakePlot=new FakePlot();
  plot=fakePlot;
  try {
    assertEquals(-1,addPlot(plot));
  }
 catch (  Exception e) {
    fail("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  assertEquals(0,fakePlot.getDrawCount());
  fakePlot=new FakePlot(){
    @Override public Composite draw(    Composite parent) throws Exception {
      super.draw(parent);
      Exception e=new Exception("String_Node_Str");
      eRef.set(e);
      throw e;
    }
  }
;
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  fakePlot.addDependentSeries("String_Node_Str",getSeries("String_Node_Str"));
  plot=fakePlot;
  try {
    addPlot(plot);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  Exception e) {
    assertSame(eRef.get(),e);
  }
  assertEquals(1,fakePlot.getDrawCount());
  assertTrue(fakePlot.children.get(0).isDisposed());
  return;
}