Program: 5084
Project: 5084
Buggy source:
private void testAddSchedule(ApplicationId appV2Id,String scheduleName) throws Exception {
  TimeSchedule timeSchedule=(TimeSchedule)Schedules.builder(scheduleName).setDescription("String_Node_Str").createTimeSchedule("String_Node_Str");
  ScheduleProgramInfo programInfo=new ScheduleProgramInfo(SchedulableProgramType.WORKFLOW,AppWithSchedule.WORKFLOW_NAME);
  ImmutableMap<String,String> properties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  ScheduleSpecification specification=new ScheduleSpecification(timeSchedule,programInfo,properties);
  HttpResponse response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,"String_Node_Str",specification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,"String_Node_Str",null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.NOT_FOUND.getCode(),response.getStatusLine().getStatusCode());
  ScheduleProgramInfo invalidScheduleProgramInfo=new ScheduleProgramInfo(SchedulableProgramType.SPARK,"String_Node_Str");
  ScheduleSpecification invalidSpecification=new ScheduleSpecification(timeSchedule,invalidScheduleProgramInfo,properties);
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,invalidSpecification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  TimeSchedule invalidTimeSchedule=(TimeSchedule)Schedules.builder("String_Node_Str").setDescription("String_Node_Str").createTimeSchedule("String_Node_Str");
  invalidSpecification=new ScheduleSpecification(invalidTimeSchedule,programInfo,properties);
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,"String_Node_Str",invalidSpecification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  List<ScheduleSpecification> schedules=getSchedules(TEST_NAMESPACE1,AppWithSchedule.NAME,AppWithSchedule.WORKFLOW_NAME);
  Assert.assertEquals(2,schedules.size());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.CONFLICT.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,appV2Id.getVersion(),scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  List<ScheduleSpecification> actualSchSpecs=listSchedules(TEST_NAMESPACE1,appV2Id.getApplication(),appV2Id.getVersion());
  Assert.assertEquals(2,actualSchSpecs.size());
  Assert.assertTrue(actualSchSpecs.contains(specification));
}

Fixed version (ground truth):
private void testAddSchedule(ApplicationId appV2Id,String scheduleName) throws Exception {
  TimeSchedule timeSchedule=(TimeSchedule)Schedules.builder(scheduleName).setDescription("String_Node_Str").createTimeSchedule("String_Node_Str");
  ScheduleProgramInfo programInfo=new ScheduleProgramInfo(SchedulableProgramType.WORKFLOW,AppWithSchedule.WORKFLOW_NAME);
  ImmutableMap<String,String> properties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  ScheduleSpecification specification=new ScheduleSpecification(timeSchedule,programInfo,properties);
  HttpResponse response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,"String_Node_Str",specification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,"String_Node_Str",null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.NOT_FOUND.getCode(),response.getStatusLine().getStatusCode());
  ScheduleProgramInfo invalidScheduleProgramInfo=new ScheduleProgramInfo(SchedulableProgramType.SPARK,"String_Node_Str");
  ScheduleSpecification invalidSpecification=new ScheduleSpecification(timeSchedule,invalidScheduleProgramInfo,properties);
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,invalidSpecification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  TimeSchedule invalidTimeSchedule=(TimeSchedule)Schedules.builder("String_Node_Str").setDescription("String_Node_Str").createTimeSchedule("String_Node_Str");
  invalidSpecification=new ScheduleSpecification(invalidTimeSchedule,programInfo,properties);
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,"String_Node_Str",invalidSpecification);
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  List<ScheduleSpecification> schedules=getSchedules(TEST_NAMESPACE1,AppWithSchedule.NAME,AppWithSchedule.WORKFLOW_NAME);
  Assert.assertEquals(2,schedules.size());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,null,scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.CONFLICT.getCode(),response.getStatusLine().getStatusCode());
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,appV2Id.getVersion(),scheduleName,specification);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  List<ScheduleSpecification> actualSchSpecs=listSchedules(TEST_NAMESPACE1,appV2Id.getApplication(),appV2Id.getVersion());
  Assert.assertEquals(2,actualSchSpecs.size());
  Assert.assertTrue(actualSchSpecs.contains(specification));
  TimeSchedule timeSchedule2=(TimeSchedule)Schedules.builder(null).setDescription("String_Node_Str").createTimeSchedule("String_Node_Str");
  ScheduleSpecification specification2=new ScheduleSpecification(timeSchedule2,programInfo,properties);
  response=addSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,appV2Id.getVersion(),"String_Node_Str",specification2);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  ScheduleSpecification schedule2=getSchedule(TEST_NAMESPACE1,AppWithSchedule.NAME,appV2Id.getVersion(),"String_Node_Str");
  Assert.assertNotNull(schedule2);
}