Program: 6856
Project: 6856
Buggy source:
@Test public void testAdapters() throws Exception {
  List<AdapterDetail> initialList=adapterClient.list();
  Assert.assertEquals(0,initialList.size());
  DummyWorkerTemplate.Config config=new DummyWorkerTemplate.Config(2);
  String adapterName="String_Node_Str";
  AdapterConfig adapterConfig=new AdapterConfig("String_Node_Str",DummyWorkerTemplate.NAME,GSON.toJsonTree(config));
  adapterClient.create(adapterName,adapterConfig);
  adapterClient.waitForExists(adapterName,30,TimeUnit.SECONDS);
  Assert.assertTrue(adapterClient.exists(adapterName));
  AdapterDetail someAdapter=adapterClient.get(adapterName);
  Assert.assertNotNull(someAdapter);
  List<AdapterDetail> list=adapterClient.list();
  Assert.assertArrayEquals(new AdapterDetail[]{someAdapter},list.toArray());
  adapterClient.waitForStatus(adapterName,AdapterStatus.STOPPED,30,TimeUnit.SECONDS);
  adapterClient.start(adapterName);
  adapterClient.waitForStatus(adapterName,AdapterStatus.STARTED,30,TimeUnit.SECONDS);
  adapterClient.stop(adapterName);
  adapterClient.waitForStatus(adapterName,AdapterStatus.STOPPED,30,TimeUnit.SECONDS);
  List<RunRecord> runs=adapterClient.getRuns(adapterName,ProgramRunStatus.ALL,0,Long.MAX_VALUE,10);
  Assert.assertEquals(1,runs.size());
  String logs=adapterClient.getLogs(adapterName);
  Assert.assertNotNull(logs);
  adapterClient.delete(adapterName);
  Assert.assertFalse(adapterClient.exists(adapterName));
  try {
    adapterClient.get(adapterName);
    Assert.fail();
  }
 catch (  AdapterNotFoundException e) {
  }
  List<AdapterDetail> finalList=adapterClient.list();
  Assert.assertEquals(0,finalList.size());
}

Fixed version (ground truth):
@Test public void testAdapters() throws Exception {
  List<AdapterDetail> initialList=adapterClient.list();
  Assert.assertEquals(0,initialList.size());
  DummyWorkerTemplate.Config config=new DummyWorkerTemplate.Config(2);
  String adapterName="String_Node_Str";
  AdapterConfig adapterConfig=new AdapterConfig("String_Node_Str",DummyWorkerTemplate.NAME,GSON.toJsonTree(config));
  adapterClient.create(adapterName,adapterConfig);
  adapterClient.waitForExists(adapterName,30,TimeUnit.SECONDS);
  Assert.assertTrue(adapterClient.exists(adapterName));
  AdapterDetail someAdapter=adapterClient.get(adapterName);
  Assert.assertNotNull(someAdapter);
  List<AdapterDetail> list=adapterClient.list();
  Assert.assertArrayEquals(new AdapterDetail[]{someAdapter},list.toArray());
  adapterClient.waitForStatus(adapterName,AdapterStatus.STOPPED,30,TimeUnit.SECONDS);
  adapterClient.start(adapterName);
  adapterClient.waitForStatus(adapterName,AdapterStatus.STARTED,30,TimeUnit.SECONDS);
  List<RunRecord> adapterRuns=adapterClient.getRuns(adapterName,ProgramRunStatus.COMPLETED,0,Long.MAX_VALUE,null);
  Assert.assertEquals(0,adapterRuns.size());
  adapterClient.stop(adapterName);
  adapterClient.waitForStatus(adapterName,AdapterStatus.STOPPED,30,TimeUnit.SECONDS);
  List<RunRecord> runs=adapterClient.getRuns(adapterName,ProgramRunStatus.ALL,0,Long.MAX_VALUE,10);
  Assert.assertEquals(1,runs.size());
  String logs=adapterClient.getLogs(adapterName);
  Assert.assertNotNull(logs);
  adapterClient.delete(adapterName);
  Assert.assertFalse(adapterClient.exists(adapterName));
  try {
    adapterClient.get(adapterName);
    Assert.fail();
  }
 catch (  AdapterNotFoundException e) {
  }
  List<AdapterDetail> finalList=adapterClient.list();
  Assert.assertEquals(0,finalList.size());
}