Program: 6814
Project: 6814
Buggy source:
@Test public void testWorkerUsage() throws Exception {
  final Id.Application app=Id.Application.from("String_Node_Str",AllProgramsApp.NAME);
  final Id.Program program=Id.Program.from(app,ProgramType.WORKER,AllProgramsApp.NoOpWorker.NAME);
  final Id.Stream stream=Id.Stream.from("String_Node_Str",AllProgramsApp.STREAM_NAME);
  final Id.DatasetInstance dataset=Id.DatasetInstance.from("String_Node_Str",AllProgramsApp.DATASET_NAME);
  Assert.assertEquals(0,getAppStreamUsage(app).size());
  Assert.assertEquals(0,getProgramStreamUsage(program).size());
  Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  Assert.assertEquals(0,getAppDatasetUsage(app).size());
  Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  deploy(AllProgramsApp.class);
  try {
    startProgram(program);
    waitState(program,"String_Node_Str");
    stopProgram(program);
    waitState(program,"String_Node_Str");
    Assert.assertTrue(getAppStreamUsage(app).contains(stream));
    Assert.assertTrue(getProgramStreamUsage(program).contains(stream));
    Assert.assertTrue(getStreamProgramUsage(stream).contains(program));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getAppDatasetUsage(app).contains(dataset));
    Assert.assertTrue(getDatasetProgramUsage(dataset).contains(program));
  }
  finally {
    deleteApp(app,200);
    Assert.assertEquals(0,getAppStreamUsage(app).size());
    Assert.assertEquals(0,getProgramStreamUsage(program).size());
    Assert.assertEquals(0,getStreamProgramUsage(stream).size());
    Assert.assertEquals(0,getAppDatasetUsage(app).size());
    Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  }
}

Fixed version (ground truth):
@Test public void testWorkerUsage() throws Exception {
  final Id.Application app=Id.Application.from("String_Node_Str",AllProgramsApp.NAME);
  final Id.Program program=Id.Program.from(app,ProgramType.WORKER,AllProgramsApp.NoOpWorker.NAME);
  final Id.Stream stream=Id.Stream.from("String_Node_Str",AllProgramsApp.STREAM_NAME);
  final Id.DatasetInstance dataset=Id.DatasetInstance.from("String_Node_Str",AllProgramsApp.DATASET_NAME);
  Assert.assertEquals(0,getAppStreamUsage(app).size());
  Assert.assertEquals(0,getProgramStreamUsage(program).size());
  Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  Assert.assertEquals(0,getAppDatasetUsage(app).size());
  Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  deploy(AllProgramsApp.class);
  try {
    startProgram(program);
    waitState(program,"String_Node_Str");
    stopProgram(program);
    waitState(program,"String_Node_Str");
    Assert.assertTrue(getAppStreamUsage(app).contains(stream));
    Assert.assertTrue(getProgramStreamUsage(program).contains(stream));
    Assert.assertTrue(getStreamProgramUsage(stream).contains(program));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getAppDatasetUsage(app).contains(dataset));
    Assert.assertTrue(getDatasetProgramUsage(dataset).contains(program));
  }
  finally {
    deleteApp(app,200);
    Assert.assertEquals(0,getAppStreamUsage(app).size());
    Assert.assertEquals(0,getProgramStreamUsage(program).size());
    Assert.assertEquals(0,getStreamProgramUsage(stream).size());
    Assert.assertEquals(0,getAppDatasetUsage(app).size());
    Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  }
}