Program: 7330
Project: 7330
Buggy source:
/** 
 * Tests for program list calls
 */
@Test public void testProgramList() throws Exception {
  testListInitialState(TEST_NAMESPACE1,ProgramType.FLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.MAPREDUCE);
  testListInitialState(TEST_NAMESPACE1,ProgramType.WORKFLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.SPARK);
  testListInitialState(TEST_NAMESPACE1,ProgramType.SERVICE);
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=deploy(AppWithServices.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  verifyProgramList(TEST_NAMESPACE1,null,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE2,null,ProgramType.SERVICE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.WORKFLOW.getCategoryName(),0);
  verifyProgramList(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName(),1);
  Assert.assertEquals(404,getProgramListResponseCode(TEST_NAMESPACE1,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName()));
  Assert.assertEquals(404,getProgramListResponseCode(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW.getCategoryName()));
  Assert.assertEquals(405,getProgramListResponseCode(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Tests for program list calls
 */
@Test public void testProgramList() throws Exception {
  testListInitialState(TEST_NAMESPACE1,ProgramType.FLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.MAPREDUCE);
  testListInitialState(TEST_NAMESPACE1,ProgramType.WORKFLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.SPARK);
  testListInitialState(TEST_NAMESPACE1,ProgramType.SERVICE);
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=deploy(AppWithServices.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  verifyProgramList(TEST_NAMESPACE1,null,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE2,null,ProgramType.SERVICE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.WORKFLOW.getCategoryName(),0);
  verifyProgramList(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName(),1);
  Assert.assertEquals(404,getProgramListResponseCode(TEST_NAMESPACE1,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName()));
  Assert.assertEquals(404,getProgramListResponseCode(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW.getCategoryName()));
  Assert.assertEquals(404,getProgramListResponseCode(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,"String_Node_Str"));
}