Program: 133535
Project: 133535
Buggy source:
/** 
 * This checks that the   {@code ICEResourcePage} properly handles differentresource file types based on the viz services available in its {@link IVizServiceFactory}.
 */
@Test public void checkVizChainOfCommand(){
  openNewEditor();
  ICEResource resource;
  vizServiceFactory=new BasicVizServiceFactory();
  FakeCSVVizService csvVizService=new FakeCSVVizService();
  FakeTXTVizService txtVizService=new FakeTXTVizService();
  vizServiceFactory.register(csvVizService);
  vizServiceFactory.register(txtVizService);
  page.setVizService(vizServiceFactory);
  assertFalse(csvVizService.createWasCalled.getAndSet(false));
  assertFalse(csvVizService.createCompleted.getAndSet(false));
  assertFalse(txtVizService.createWasCalled.getAndSet(false));
  assertFalse(txtVizService.createCompleted.getAndSet(false));
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (txtVizService.createWasCalled.getAndSet(false)) {
    assertFalse(txtVizService.createCompleted.getAndSet(false));
  }
  assertTrue(csvVizService.createWasCalled.getAndSet(false));
  assertTrue(csvVizService.createCompleted.getAndSet(false));
  assertEquals(1,csvVizService.plots.get(0).getDrawCount());
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (csvVizService.createWasCalled.getAndSet(false)) {
    assertFalse(csvVizService.createCompleted.getAndSet(false));
  }
  assertTrue(txtVizService.createWasCalled.getAndSet(false));
  assertTrue(txtVizService.createCompleted.getAndSet(false));
  assertEquals(1,txtVizService.plots.get(0).getDrawCount());
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (txtVizService.createWasCalled.getAndSet(false)) {
    assertFalse(txtVizService.createCompleted.getAndSet(false));
  }
  assertTrue(csvVizService.createWasCalled.getAndSet(false));
  assertTrue(csvVizService.createCompleted.getAndSet(false));
  assertEquals(1,csvVizService.plots.get(1).getDrawCount());
  closeEditor();
  return;
}

Fixed version (ground truth):
/** 
 * This checks that the   {@code ICEResourcePage} properly handles differentresource file types based on the viz services available in its {@link IVizServiceFactory}.
 */
@Test public void checkVizChainOfCommand(){
  openNewEditor();
  ICEResource resource;
  vizServiceFactory=new BasicVizServiceFactory();
  FakeCSVVizService csvVizService=new FakeCSVVizService(){
    @Override public IPlot createPlot(    URI file) throws Exception {
      FakePlot plot=(FakePlot)super.createPlot(file);
      plot.addDependentSeries("String_Node_Str",new CSVSeries(null));
      return plot;
    }
  }
;
  FakeTXTVizService txtVizService=new FakeTXTVizService(){
    @Override public IPlot createPlot(    URI file) throws Exception {
      FakePlot plot=(FakePlot)super.createPlot(file);
      plot.addDependentSeries("String_Node_Str",new CSVSeries(null));
      return plot;
    }
  }
;
  vizServiceFactory.register(csvVizService);
  vizServiceFactory.register(txtVizService);
  page.setVizService(vizServiceFactory);
  assertFalse(csvVizService.createWasCalled.getAndSet(false));
  assertFalse(csvVizService.createCompleted.getAndSet(false));
  assertFalse(txtVizService.createWasCalled.getAndSet(false));
  assertFalse(txtVizService.createCompleted.getAndSet(false));
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (txtVizService.createWasCalled.getAndSet(false)) {
    assertFalse(txtVizService.createCompleted.getAndSet(false));
  }
  assertTrue(csvVizService.createWasCalled.getAndSet(false));
  assertTrue(csvVizService.createCompleted.getAndSet(false));
  assertEquals(1,csvVizService.plots.get(0).getDrawCount());
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (csvVizService.createWasCalled.getAndSet(false)) {
    assertFalse(csvVizService.createCompleted.getAndSet(false));
  }
  assertTrue(txtVizService.createWasCalled.getAndSet(false));
  assertTrue(txtVizService.createCompleted.getAndSet(false));
  assertEquals(1,txtVizService.plots.get(0).getDrawCount());
  resource=createVizResource(new File("String_Node_Str"));
  resources.add(resource);
  doubleClickResource(resource);
  if (txtVizService.createWasCalled.getAndSet(false)) {
    assertFalse(txtVizService.createCompleted.getAndSet(false));
  }
  assertTrue(csvVizService.createWasCalled.getAndSet(false));
  assertTrue(csvVizService.createCompleted.getAndSet(false));
  assertEquals(1,csvVizService.plots.get(1).getDrawCount());
  closeEditor();
  return;
}