Program: 4951
Project: 4951
Buggy source:
@Ignore @Test public void testWorkflowSchedules() throws Exception {
  String appName="String_Node_Str";
  String workflowName="String_Node_Str";
  String sampleSchedule="String_Node_Str";
  HttpResponse response=deploy(AppWithSchedule.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,appName,ProgramType.WORKFLOW,workflowName);
  Map<String,String> runtimeArguments=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  setAndTestRuntimeArgs(programId,runtimeArguments);
  List<ScheduleDetail> schedules=getSchedules(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(1,schedules.size());
  String scheduleName=schedules.get(0).getName();
  Assert.assertFalse(scheduleName.isEmpty());
  List<ScheduleSpecification> specs=getScheduleSpecs(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(1,specs.size());
  String specName=specs.get(0).getSchedule().getName();
  Assert.assertEquals(scheduleName,specName);
  long current=System.currentTimeMillis();
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule));
  assertSchedule(programId,scheduleName,true,30,TimeUnit.SECONDS);
  List<ScheduledRuntime> runtimes=getScheduledRunTime(programId,true);
  String id=runtimes.get(0).getId();
  Assert.assertTrue(String.format("String_Node_Str",id,scheduleName),id.contains(scheduleName));
  Long nextRunTime=runtimes.get(0).getTime();
  Assert.assertTrue(String.format("String_Node_Str",nextRunTime,current),nextRunTime > current);
  verifyProgramRuns(programId,"String_Node_Str");
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,false,30,TimeUnit.SECONDS);
  List<ScheduledRuntime> previousRuntimes=getScheduledRunTime(programId,false);
  int numRuns=previousRuntimes.size();
  Assert.assertTrue(String.format("String_Node_Str" + "String_Node_Str",numRuns),numRuns >= 1);
  verifyNoRunWithStatus(programId,"String_Node_Str");
  int workflowRuns=getProgramRuns(programId,"String_Node_Str").size();
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,true,30,TimeUnit.SECONDS);
  verifyProgramRuns(programId,"String_Node_Str",workflowRuns);
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,false,30,TimeUnit.SECONDS);
  try {
    assertSchedule(programId,"String_Node_Str",true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  try {
    assertSchedule(Id.Program.from(TEST_NAMESPACE1,appName,ProgramType.WORKFLOW,workflowName),scheduleName,true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(404,suspendSchedule(TEST_NAMESPACE1,appName,scheduleName));
  Assert.assertEquals(404,resumeSchedule(TEST_NAMESPACE1,appName,scheduleName));
  verifyNoRunWithStatus(programId,"String_Node_Str");
  deleteApp(Id.Application.from(TEST_NAMESPACE2,AppWithSchedule.class.getSimpleName()),200);
}

Fixed version (ground truth):
@Ignore @Test public void testWorkflowSchedules() throws Exception {
  String appName=AppWithSchedule.NAME;
  String workflowName=AppWithSchedule.WORKFLOW_NAME;
  String sampleSchedule=AppWithSchedule.SCHEDULE;
  HttpResponse response=deploy(AppWithSchedule.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,appName,ProgramType.WORKFLOW,workflowName);
  Map<String,String> runtimeArguments=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  setAndTestRuntimeArgs(programId,runtimeArguments);
  List<ScheduleDetail> schedules=getSchedules(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(1,schedules.size());
  String scheduleName=schedules.get(0).getName();
  Assert.assertFalse(scheduleName.isEmpty());
  List<ScheduleSpecification> specs=getScheduleSpecs(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(1,specs.size());
  String specName=specs.get(0).getSchedule().getName();
  Assert.assertEquals(scheduleName,specName);
  long current=System.currentTimeMillis();
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule));
  assertSchedule(programId,scheduleName,true,30,TimeUnit.SECONDS);
  List<ScheduledRuntime> runtimes=getScheduledRunTime(programId,true);
  String id=runtimes.get(0).getId();
  Assert.assertTrue(String.format("String_Node_Str",id,scheduleName),id.contains(scheduleName));
  Long nextRunTime=runtimes.get(0).getTime();
  Assert.assertTrue(String.format("String_Node_Str",nextRunTime,current),nextRunTime > current);
  verifyProgramRuns(programId,"String_Node_Str");
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,false,30,TimeUnit.SECONDS);
  List<ScheduledRuntime> previousRuntimes=getScheduledRunTime(programId,false);
  int numRuns=previousRuntimes.size();
  Assert.assertTrue(String.format("String_Node_Str" + "String_Node_Str",numRuns),numRuns >= 1);
  verifyNoRunWithStatus(programId,"String_Node_Str");
  int workflowRuns=getProgramRuns(programId,"String_Node_Str").size();
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,true,30,TimeUnit.SECONDS);
  verifyProgramRuns(programId,"String_Node_Str",workflowRuns);
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName));
  assertSchedule(programId,scheduleName,false,30,TimeUnit.SECONDS);
  try {
    assertSchedule(programId,"String_Node_Str",true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  try {
    assertSchedule(Id.Program.from(TEST_NAMESPACE1,appName,ProgramType.WORKFLOW,workflowName),scheduleName,true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(404,suspendSchedule(TEST_NAMESPACE1,appName,scheduleName));
  Assert.assertEquals(404,resumeSchedule(TEST_NAMESPACE1,appName,scheduleName));
  verifyNoRunWithStatus(programId,"String_Node_Str");
  deleteApp(Id.Application.from(TEST_NAMESPACE2,AppWithSchedule.class.getSimpleName()),200);
}