nus-yam/ex-repair huggingface dataset:
Program: 4206
Project: 4206
Buggy source:
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().supportsL().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().supportsL().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().matchDayOfWeekAndDayOfMonth().instance();
}
Program: 4208
Project: 4208
Buggy source:
@Before public void setUp(){
  testFieldName1=CronFieldName.SECOND;
  testFieldName2=CronFieldName.MINUTE;
  testFieldName3=CronFieldName.HOUR;
  MockitoAnnotations.initMocks(this);
  when(mockFieldDefinition1.getFieldName()).thenReturn(testFieldName1);
  when(mockFieldDefinition2.getFieldName()).thenReturn(testFieldName2);
  when(mockFieldDefinition3optional.getFieldName()).thenReturn(testFieldName3);
  when(mockFieldDefinition3optional.isOptional()).thenReturn(Boolean.TRUE);
  enforceStrictRange=false;
}

Fixed version (ground truth):
@Before public void setUp(){
  testFieldName1=CronFieldName.SECOND;
  testFieldName2=CronFieldName.MINUTE;
  testFieldName3=CronFieldName.HOUR;
  MockitoAnnotations.initMocks(this);
  when(mockFieldDefinition1.getFieldName()).thenReturn(testFieldName1);
  when(mockFieldDefinition2.getFieldName()).thenReturn(testFieldName2);
  when(mockFieldDefinition3optional.getFieldName()).thenReturn(testFieldName3);
  when(mockFieldDefinition3optional.isOptional()).thenReturn(Boolean.TRUE);
  enforceStrictRange=false;
  matchDayOfWeekAndDayOfMonth=false;
}
Program: 4209
Project: 4209
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testLastFieldOptionalNotAllowedOnSingleFieldDefinition() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition3optional);
  new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testLastFieldOptionalNotAllowedOnSingleFieldDefinition() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition3optional);
  new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange,matchDayOfWeekAndDayOfMonth);
}
Program: 4210
Project: 4210
Buggy source:
@Test public void testGetFieldDefinitions() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition1);
  CronDefinition cronDefinition=new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange);
  assertNotNull(cronDefinition.getFieldDefinitions());
  assertEquals(1,cronDefinition.getFieldDefinitions().size());
  assertTrue(cronDefinition.getFieldDefinitions().contains(mockFieldDefinition1));
}

Fixed version (ground truth):
@Test public void testGetFieldDefinitions() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition1);
  CronDefinition cronDefinition=new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange,matchDayOfWeekAndDayOfMonth);
  assertNotNull(cronDefinition.getFieldDefinitions());
  assertEquals(1,cronDefinition.getFieldDefinitions().size());
  assertTrue(cronDefinition.getFieldDefinitions().contains(mockFieldDefinition1));
}
Program: 4211
Project: 4211
Buggy source:
@Test(expected=NullPointerException.class) public void testConstructorNullFieldsParameter() throws Exception {
  new CronDefinition(null,Sets.newHashSet(),enforceStrictRange);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testConstructorNullFieldsParameter() throws Exception {
  new CronDefinition(null,Sets.newHashSet(),enforceStrictRange,matchDayOfWeekAndDayOfMonth);
}
Program: 4212
Project: 4212
Buggy source:
@Test(expected=NullPointerException.class) public void testConstructorNullConstraintsParameter() throws Exception {
  new CronDefinition(Lists.newArrayList(),null,enforceStrictRange);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testConstructorNullConstraintsParameter() throws Exception {
  new CronDefinition(Lists.newArrayList(),null,enforceStrictRange,matchDayOfWeekAndDayOfMonth);
}
Program: 4213
Project: 4213
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testConstructorEmptyFieldsParameter() throws Exception {
  new CronDefinition(new ArrayList<>(),Sets.newHashSet(),enforceStrictRange);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testConstructorEmptyFieldsParameter() throws Exception {
  new CronDefinition(new ArrayList<>(),Sets.newHashSet(),enforceStrictRange,matchDayOfWeekAndDayOfMonth);
}
Program: 4214
Project: 4214
Buggy source:
@Test public void testLastFieldOptionalTrueWhenSet() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition1);
  fields.add(mockFieldDefinition2);
  fields.add(mockFieldDefinition3optional);
  assertTrue(new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange).getFieldDefinitions().stream().sorted((o1,o2) -> o1.getFieldName().getOrder() - o2.getFieldName().getOrder()).collect(Collectors.toList()).get(fields.size() - 1).isOptional());
}

Fixed version (ground truth):
@Test public void testLastFieldOptionalTrueWhenSet() throws Exception {
  List<FieldDefinition> fields=Lists.newArrayList();
  fields.add(mockFieldDefinition1);
  fields.add(mockFieldDefinition2);
  fields.add(mockFieldDefinition3optional);
  assertTrue(new CronDefinition(fields,Sets.newHashSet(),enforceStrictRange,matchDayOfWeekAndDayOfMonth).getFieldDefinitions().stream().sorted((o1,o2) -> o1.getFieldName().getOrder() - o2.getFieldName().getOrder()).collect(Collectors.toList()).get(fields.size() - 1).isOptional());
}
Program: 4215
Project: 4215
Buggy source:
@Override public String asString(){
  if (period.getValue() == 1) {
    return expression.asString() != null ? expression.asString() : "String_Node_Str";
  }
  return String.format("String_Node_Str",expression.asString(),getPeriod());
}

Fixed version (ground truth):
@Override public String asString(){
  String expressionAsString=expression.asString();
  if ("String_Node_Str".equals(expressionAsString) && period.getValue() == 1) {
    return expressionAsString;
  }
  return String.format("String_Node_Str",expressionAsString,period);
}
Program: 4216
Project: 4216
Buggy source:
public void testAsString() throws Exception {
  assertEquals("String_Node_Str",new Every(new On(new IntegerFieldValue(0)),new IntegerFieldValue(1)).asString());
}

Fixed version (ground truth):
@Test public void testAsString() throws Exception {
  assertEquals("String_Node_Str",new Every(new On(new IntegerFieldValue(0)),new IntegerFieldValue(1)).asString());
}
Program: 4217
Project: 4217
Buggy source:
public void testParseOnWithHash01() throws Exception {
  int on=5;
  int hashValue=3;
  On onExpression=(On)parser.parse(String.format("String_Node_Str",on,hashValue));
  assertEquals(on,(int)(onExpression.getTime().getValue()));
  assertEquals(hashValue,onExpression.getNth().getValue().intValue());
  assertEquals(SpecialChar.HASH,onExpression.getSpecialChar().getValue());
}

Fixed version (ground truth):
@Test public void testParseOnWithHash01() throws Exception {
  int on=5;
  int hashValue=3;
  On onExpression=(On)parser.parse(String.format("String_Node_Str",on,hashValue));
  assertEquals(on,(int)(onExpression.getTime().getValue()));
  assertEquals(hashValue,onExpression.getNth().getValue().intValue());
  assertEquals(SpecialChar.HASH,onExpression.getSpecialChar().getValue());
}
Program: 4218
Project: 4218
Buggy source:
@Before public void setUp(){
  parser=new FieldParser(FieldConstraintsBuilder.instance().createConstraintsInstance());
}

Fixed version (ground truth):
@Before public void setUp(){
  parser=new FieldParser(FieldConstraintsBuilder.instance().addHashSupport().createConstraintsInstance());
}
Program: 4219
Project: 4219
Buggy source:
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().supportsL().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}
Program: 4220
Project: 4220
Buggy source:
@VisibleForTesting protected On parseOnWithHash(String exp){
  SpecialCharFieldValue specialChar=new SpecialCharFieldValue(HASH);
  String[] array=exp.split(HASH_TAG);
  IntegerFieldValue nth=mapToIntegerFieldValue(array[1]);
  if (array[0].isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new On(mapToIntegerFieldValue(array[0]),specialChar,nth);
}

Fixed version (ground truth):
@VisibleForTesting protected On parseOnWithHash(String exp){
  if (!fieldConstraints.getSpecialChars().contains(HASH))   throw new IllegalArgumentException("String_Node_Str" + exp);
  SpecialCharFieldValue specialChar=new SpecialCharFieldValue(HASH);
  String[] array=exp.split(HASH_TAG);
  IntegerFieldValue nth=mapToIntegerFieldValue(array[1]);
  if (array[0].isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new On(mapToIntegerFieldValue(array[0]),specialChar,nth);
}
Program: 4221
Project: 4221
Buggy source:
@Test public void testParseSunday() throws Exception {
  String cronExpr="String_Node_Str";
  cron4jParser.parse(cronExpr);
}

Fixed version (ground truth):
public void testParseSunday() throws Exception {
  String cronExpr="String_Node_Str";
  cron4jParser.parse(cronExpr);
}
Program: 4222
Project: 4222
Buggy source:
@Override public String asString(){
  if (period.getValue() == 1) {
    return expression.asString() != null ? expression.asString() : "String_Node_Str";
  }
  return String.format("String_Node_Str",expression.asString(),getPeriod());
}

Fixed version (ground truth):
@Override public String asString(){
  String expressionAsString=expression.asString();
  if ("String_Node_Str".equals(expressionAsString) && period.getValue() == 1) {
    return expressionAsString;
  }
  return String.format("String_Node_Str",expressionAsString,period);
}
Program: 4223
Project: 4223
Buggy source:
public void testAsString() throws Exception {
  assertEquals("String_Node_Str",new Every(new On(new IntegerFieldValue(0)),new IntegerFieldValue(1)).asString());
}

Fixed version (ground truth):
@Test public void testAsString() throws Exception {
  assertEquals("String_Node_Str",new Every(new On(new IntegerFieldValue(0)),new IntegerFieldValue(1)).asString());
}
Program: 4224
Project: 4224
Buggy source:
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().supportsL().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}
Program: 4225
Project: 4225
Buggy source:
private TimeNode generateDayCandidatesUsingDoY(ZonedDateTime reference){
  final int year=reference.getYear();
  final int month=reference.getMonthValue();
  LocalDate date=LocalDate.of(year,1,1);
  int lengthOfYear=date.lengthOfYear();
  List<Integer> candidates=createDayOfYearValueGeneratorInstance(daysOfYearCronField,year).generateCandidates(1,lengthOfYear);
  Range<Integer> rangeOfMonth=Range.closedOpen(LocalDate.of(year,month,1).getDayOfYear(),LocalDate.of(year,month + 1,1).getDayOfYear());
  Stream<Integer> candidatesFilteredByMonth=candidates.stream().filter(dayOfYear -> rangeOfMonth.contains(dayOfYear));
  Stream<Integer> uniqueCandidates=candidatesFilteredByMonth.distinct();
  Stream<Integer> candidatesMappedToDayOfMonth=uniqueCandidates.map(dayOfYear -> LocalDate.ofYearDay(reference.getYear(),dayOfYear).getDayOfMonth());
  return new TimeNode(candidatesMappedToDayOfMonth.collect(Collectors.toList()));
}

Fixed version (ground truth):
private TimeNode generateDayCandidatesUsingDoY(ZonedDateTime reference){
  final int year=reference.getYear();
  final int month=reference.getMonthValue();
  LocalDate date=LocalDate.of(year,1,1);
  int lengthOfYear=date.lengthOfYear();
  List<Integer> candidates=createDayOfYearValueGeneratorInstance(daysOfYearCronField,year).generateCandidates(1,lengthOfYear);
  Range<Integer> rangeOfMonth=Range.closedOpen(LocalDate.of(year,month,1).getDayOfYear(),month == 12 ? LocalDate.of(year,12,31).getDayOfYear() + 1 : LocalDate.of(year,month + 1,1).getDayOfYear());
  Stream<Integer> candidatesFilteredByMonth=candidates.stream().filter(dayOfYear -> rangeOfMonth.contains(dayOfYear));
  Stream<Integer> uniqueCandidates=candidatesFilteredByMonth.distinct();
  Stream<Integer> candidatesMappedToDayOfMonth=uniqueCandidates.map(dayOfYear -> LocalDate.ofYearDay(reference.getYear(),dayOfYear).getDayOfMonth());
  return new TimeNode(candidatesMappedToDayOfMonth.collect(Collectors.toList()));
}
Program: 4226
Project: 4226
Buggy source:
@Test public void testForCron() throws Exception {
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(FIRST_QUATER_BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_SPECIFIC_DAY_OF_YEAR)).getClass());
}

Fixed version (ground truth):
@Test public void testForCron(){
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(FIRST_QUATER_BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_SPECIFIC_DAY_OF_YEAR)).getClass());
}
Program: 4227
Project: 4227
Buggy source:
public void testLastExecutionEveryTwoWeeksStartingWithFirstDayOfYear() throws Exception {
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now : now.minusDays(dayOfMostRecentPeriod - 1);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.lastExecution(now).get());
}

Fixed version (ground truth):
@Test public void testLastExecutionEveryTwoWeeksStartingWithFirstDayOfYear(){
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now.minusDays(14) : now.minusDays(dayOfMostRecentPeriod - 1);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.lastExecution(now).get());
}
Program: 4228
Project: 4228
Buggy source:
public void testNextExecutionEveryTwoWeeksStartingWithFirstDayOfYear() throws Exception {
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now : now.plusDays(15 - dayOfMostRecentPeriod);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.nextExecution(now).get());
}

Fixed version (ground truth):
@Test public void testNextExecutionEveryTwoWeeksStartingWithFirstDayOfYear(){
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=now.plusDays(15 - dayOfMostRecentPeriod);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.nextExecution(now).get());
}
Program: 4229
Project: 4229
Buggy source:
private Always(Always always){
  this();
}

Fixed version (ground truth):
/** 
 * Should be package private and not be instantiated elsewhere. Class should become package private too.
 * @deprecated rather use {@link FieldExpression#always()()}
 */
@Deprecated public Always(){
}
Program: 4230
Project: 4230
Buggy source:
public QuestionMark(){
}

Fixed version (ground truth):
/** 
 * Should be package private and not be instantiated elsewhere. Class should become package private too.
 * @deprecated rather use {@link FieldExpression#questionMark()}
 */
@Deprecated public QuestionMark(){
}
Program: 4231
Project: 4231
Buggy source:
/** 
 * Issue #151: L-7 in day of month should work to find the day 7 days prior to the last day of the month.
 */
public void testLSupportedInDoMRangeNextExecutionCalculation(){
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime now=ZonedDateTime.parse("String_Node_Str");
  ZonedDateTime nextExecution=executionTime.nextExecution(now).get();
  ZonedDateTime assertDate=ZonedDateTime.parse("String_Node_Str");
  assertEquals(assertDate,nextExecution);
}

Fixed version (ground truth):
/** 
 * Issue #151: L-7 in day of month should work to find the day 7 days prior to the last day of the month.
 */
@Test public void testLSupportedInDoMRangeNextExecutionCalculation(){
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime now=ZonedDateTime.parse("String_Node_Str");
  ZonedDateTime nextExecution=executionTime.nextExecution(now).get();
  ZonedDateTime assertDate=ZonedDateTime.parse("String_Node_Str");
  assertEquals(assertDate,nextExecution);
}
Program: 4232
Project: 4232
Buggy source:
private TimeNode generateDayCandidatesUsingDoY(ZonedDateTime reference){
  final int year=reference.getYear();
  final int month=reference.getMonthValue();
  LocalDate date=LocalDate.of(year,1,1);
  int lengthOfYear=date.lengthOfYear();
  List<Integer> candidates=createDayOfYearValueGeneratorInstance(daysOfYearCronField,year).generateCandidates(1,lengthOfYear);
  Range<Integer> rangeOfMonth=Range.closedOpen(LocalDate.of(year,month,1).getDayOfYear(),LocalDate.of(year,month + 1,1).getDayOfYear());
  Stream<Integer> candidatesFilteredByMonth=candidates.stream().filter(dayOfYear -> rangeOfMonth.contains(dayOfYear));
  Stream<Integer> uniqueCandidates=candidatesFilteredByMonth.distinct();
  Stream<Integer> candidatesMappedToDayOfMonth=uniqueCandidates.map(dayOfYear -> LocalDate.ofYearDay(reference.getYear(),dayOfYear).getDayOfMonth());
  return new TimeNode(candidatesMappedToDayOfMonth.collect(Collectors.toList()));
}

Fixed version (ground truth):
private TimeNode generateDayCandidatesUsingDoY(ZonedDateTime reference){
  final int year=reference.getYear();
  final int month=reference.getMonthValue();
  LocalDate date=LocalDate.of(year,1,1);
  int lengthOfYear=date.lengthOfYear();
  List<Integer> candidates=createDayOfYearValueGeneratorInstance(daysOfYearCronField,year).generateCandidates(1,lengthOfYear);
  Range<Integer> rangeOfMonth=Range.closedOpen(LocalDate.of(year,month,1).getDayOfYear(),month == 12 ? LocalDate.of(year,12,31).getDayOfYear() + 1 : LocalDate.of(year,month + 1,1).getDayOfYear());
  Stream<Integer> candidatesFilteredByMonth=candidates.stream().filter(dayOfYear -> rangeOfMonth.contains(dayOfYear));
  Stream<Integer> uniqueCandidates=candidatesFilteredByMonth.distinct();
  Stream<Integer> candidatesMappedToDayOfMonth=uniqueCandidates.map(dayOfYear -> LocalDate.ofYearDay(reference.getYear(),dayOfYear).getDayOfMonth());
  return new TimeNode(candidatesMappedToDayOfMonth.collect(Collectors.toList()));
}
Program: 4233
Project: 4233
Buggy source:
@Test public void testForCron() throws Exception {
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(FIRST_QUATER_BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_SPECIFIC_DAY_OF_YEAR)).getClass());
}

Fixed version (ground truth):
@Test public void testForCron(){
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(FIRST_QUATER_BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_DAY_OF_YEAR)).getClass());
  assertEquals(ExecutionTime.class,ExecutionTime.forCron(parser.parse(WITHOUT_SPECIFIC_DAY_OF_YEAR)).getClass());
}
Program: 4234
Project: 4234
Buggy source:
public void testLastExecutionEveryTwoWeeksStartingWithFirstDayOfYear() throws Exception {
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now : now.minusDays(dayOfMostRecentPeriod - 1);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.lastExecution(now).get());
}

Fixed version (ground truth):
@Test public void testLastExecutionEveryTwoWeeksStartingWithFirstDayOfYear(){
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now.minusDays(14) : now.minusDays(dayOfMostRecentPeriod - 1);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.lastExecution(now).get());
}
Program: 4235
Project: 4235
Buggy source:
public void testNextExecutionEveryTwoWeeksStartingWithFirstDayOfYear() throws Exception {
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=dayOfMostRecentPeriod == 1 ? now : now.plusDays(15 - dayOfMostRecentPeriod);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.nextExecution(now).get());
}

Fixed version (ground truth):
@Test public void testNextExecutionEveryTwoWeeksStartingWithFirstDayOfYear(){
  ZonedDateTime now=truncateToDays(ZonedDateTime.now());
  int dayOfYear=now.getDayOfYear();
  int dayOfMostRecentPeriod=dayOfYear % 14;
  ZonedDateTime expected=now.plusDays(15 - dayOfMostRecentPeriod);
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(BI_WEEKLY_STARTING_WITH_FIRST_DAY_OF_YEAR));
  assertEquals(expected,executionTime.nextExecution(now).get());
}
Program: 4236
Project: 4236
Buggy source:
/** 
 * Should be package private and not be instantiated elsewhere. Class should become package private too.
 * @deprecated rather use {@link FieldExpression#always()()}
 */
@Deprecated public Always(){
}

Fixed version (ground truth):
/** 
 * Should be package private and not be instantiated elsewhere. Class should become package private too.
 * @deprecated rather use {@link FieldExpression#always()}
 */
@Deprecated public Always(){
}
Program: 4237
Project: 4237
Buggy source:
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(0)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}

Fixed version (ground truth):
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(1)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}
Program: 4238
Project: 4238
Buggy source:
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(0)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}

Fixed version (ground truth):
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(1)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}
Program: 4239
Project: 4239
Buggy source:
/** 
 * Issue #151: L-7 in day of month should work to find the day 7 days prior to the last day of the month.
 */
public void testLSupportedInDoMRangeNextExecutionCalculation(){
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime now=ZonedDateTime.parse("String_Node_Str");
  ZonedDateTime nextExecution=executionTime.nextExecution(now).get();
  ZonedDateTime assertDate=ZonedDateTime.parse("String_Node_Str");
  assertEquals(assertDate,nextExecution);
}

Fixed version (ground truth):
/** 
 * Issue #151: L-7 in day of month should work to find the day 7 days prior to the last day of the month.
 */
@Test public void testLSupportedInDoMRangeNextExecutionCalculation(){
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime now=ZonedDateTime.parse("String_Node_Str");
  ZonedDateTime nextExecution=executionTime.nextExecution(now).get();
  ZonedDateTime assertDate=ZonedDateTime.parse("String_Node_Str");
  assertEquals(assertDate,nextExecution);
}
Program: 4240
Project: 4240
Buggy source:
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(0)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}

Fixed version (ground truth):
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(1)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}
Program: 4241
Project: 4241
Buggy source:
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(0)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}

Fixed version (ground truth):
/** 
 * Issue #148: Cron Builder/Parser fails on Every X years
 */
@Test public void testEveryXYears(){
  CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)).withDoM(FieldExpressionFactory.on(1)).withDoW(FieldExpressionFactory.questionMark()).withYear(FieldExpressionFactory.every(FieldExpressionFactory.between(1970,2099),4)).withMonth(FieldExpressionFactory.on(1)).withHour(FieldExpressionFactory.on(0)).withMinute(FieldExpressionFactory.on(0)).withSecond(FieldExpressionFactory.on(0));
}
Program: 4243
Project: 4243
Buggy source:
/** 
 * Provide feedback if a given date matches the cron expression.
 * @param date - ZonedDateTime instance. If null, a NullPointerException will be raised.
 * @return true if date matches cron expression requirements, false otherwise.
 */
public boolean isMatch(ZonedDateTime date){
  Optional<ZonedDateTime> last=lastExecution(date);
  if (last.isPresent()) {
    Optional<ZonedDateTime> next=nextExecution(last.get());
    if (next.isPresent()) {
      return next.get().equals(date);
    }
 else {
      boolean everythingInRange=false;
      try {
        everythingInRange=dateValuesInExpectedRanges(nextClosestMatch(date),date);
      }
 catch (      NoSuchValueException ignored) {
      }
      try {
        everythingInRange=dateValuesInExpectedRanges(previousClosestMatch(date),date);
      }
 catch (      NoSuchValueException ignored) {
      }
      return everythingInRange;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isMatch(){
  return isMatch;
}
Program: 4244
Project: 4244
Buggy source:
private ZonedDateTime initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute,ZoneId timeZone,boolean next) throws NoSuchValueException {
  ZonedDateTime date=ZonedDateTime.of(LocalDateTime.of(0,1,1,0,0,0),timeZone).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
  ZonedDateTime result=ensureSameDate(date,years,monthsOfYear,dayOfMonth,hoursOfDay,minutesOfHour,secondsOfMinute);
  if (isSameDate(result,years,monthsOfYear,dayOfMonth,hoursOfDay,minutesOfHour,secondsOfMinute)) {
    return result;
  }
 else {
    if (next) {
      return nextClosestMatch(result);
    }
 else {
      return previousClosestMatch(result);
    }
  }
}

Fixed version (ground truth):
private ExecutionTimeResult initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute,ZoneId timeZone) throws NoSuchValueException {
  ZonedDateTime date=ZonedDateTime.of(LocalDateTime.of(0,1,1,0,0,0),timeZone).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
  ZonedDateTime result=ensureSameDate(date,years,monthsOfYear,dayOfMonth,hoursOfDay,minutesOfHour,secondsOfMinute);
  if (isSameDate(result,years,monthsOfYear,dayOfMonth,hoursOfDay,minutesOfHour,secondsOfMinute)) {
    return new ExecutionTimeResult(result,true);
  }
  return new ExecutionTimeResult(result,false);
}
Program: 4246
Project: 4246
Buggy source:
/** 
 * Provide description for day of week
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeDayOfWeek(Map<CronFieldName,CronField> fields){
  String description=DescriptionStrategyFactory.daysOfWeekInstance(bundle,fields.containsKey(CronFieldName.DAY_OF_WEEK) ? fields.get(CronFieldName.DAY_OF_WEEK).getExpression() : null).describe();
  return this.addExpressions(description,bundle.getString("String_Node_Str"),bundle.getString("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Provide description for day of week
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeDayOfWeek(Map<CronFieldName,CronField> fields,Map<CronFieldName,FieldDefinition> definitions){
  String description=DescriptionStrategyFactory.daysOfWeekInstance(bundle,fields.containsKey(CronFieldName.DAY_OF_WEEK) ? fields.get(CronFieldName.DAY_OF_WEEK).getExpression() : null,definitions.containsKey(CronFieldName.DAY_OF_WEEK) ? definitions.get(CronFieldName.DAY_OF_WEEK) : null).describe();
  return this.addExpressions(description,bundle.getString("String_Node_Str"),bundle.getString("String_Node_Str"));
}
Program: 4247
Project: 4247
Buggy source:
/** 
 * Provide a description of given CronFieldParseResult list
 * @param cron - Cron instance, never nullif null, will throw NullPointerException
 * @return description - String
 */
public String describe(Cron cron){
  Preconditions.checkNotNull(cron,"String_Node_Str");
  Map<CronFieldName,CronField> expressions=cron.retrieveFieldsAsMap();
  return new StringBuilder().append(describeHHmmss(expressions)).append("String_Node_Str").append(describeDayOfMonth(expressions)).append("String_Node_Str").append(describeMonth(expressions)).append("String_Node_Str").append(describeDayOfWeek(expressions)).append("String_Node_Str").append(describeYear(expressions)).toString().replaceAll("String_Node_Str","String_Node_Str").trim();
}

Fixed version (ground truth):
/** 
 * Provide a description of given CronFieldParseResult list
 * @param cron - Cron instance, never nullif null, will throw NullPointerException
 * @return description - String
 */
public String describe(Cron cron){
  Preconditions.checkNotNull(cron,"String_Node_Str");
  Map<CronFieldName,CronField> expressions=cron.retrieveFieldsAsMap();
  Map<CronFieldName,FieldDefinition> fieldDefinitions=cron.getCronDefinition().retrieveFieldDefinitionsAsMap();
  return new StringBuilder().append(describeHHmmss(expressions)).append("String_Node_Str").append(describeDayOfMonth(expressions)).append("String_Node_Str").append(describeMonth(expressions)).append("String_Node_Str").append(describeDayOfWeek(expressions,fieldDefinitions)).append("String_Node_Str").append(describeYear(expressions)).toString().replaceAll("String_Node_Str","String_Node_Str").trim();
}
Program: 4248
Project: 4248
Buggy source:
/** 
 * Creates description strategy for days of week
 * @param bundle - locale
 * @param expression - CronFieldExpression
 * @return - DescriptionStrategy instance, never null
 */
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle,final FieldExpression expression){
  final Function<Integer,String> nominal=integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL,bundle.getLocale());
  NominalDescriptionStrategy dow=new NominalDescriptionStrategy(bundle,nominal,expression);
  dow.addDescription(fieldExpression -> {
    if (fieldExpression instanceof On) {
      On on=(On)fieldExpression;
switch (on.getSpecialChar().getValue()) {
case HASH:
        return String.format("String_Node_Str",nominal.apply(on.getTime().getValue()),on.getNth(),bundle.getString("String_Node_Str"));
case L:
      return String.format("String_Node_Str",bundle.getString("String_Node_Str"),nominal.apply(on.getTime().getValue()),bundle.getString("String_Node_Str"));
default :
    return "String_Node_Str";
}
}
return "String_Node_Str";
}
);
return dow;
}

Fixed version (ground truth):
/** 
 * Creates description strategy for days of week
 * @param bundle - locale
 * @param expression - CronFieldExpression
 * @return - DescriptionStrategy instance, never null
 */
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle,final FieldExpression expression,final FieldDefinition definition){
  final Function<Integer,String> nominal=integer -> {
    int diff=definition instanceof DayOfWeekFieldDefinition ? DayOfWeek.MONDAY.getValue() - ((DayOfWeekFieldDefinition)definition).getMondayDoWValue().getMondayDoWValue() : 0;
    return DayOfWeek.of(integer + diff < 1 ? 7 : integer + diff).getDisplayName(TextStyle.FULL,bundle.getLocale());
  }
;
  NominalDescriptionStrategy dow=new NominalDescriptionStrategy(bundle,nominal,expression);
  dow.addDescription(fieldExpression -> {
    if (fieldExpression instanceof On) {
      On on=(On)fieldExpression;
switch (on.getSpecialChar().getValue()) {
case HASH:
        return String.format("String_Node_Str",nominal.apply(on.getTime().getValue()),on.getNth(),bundle.getString("String_Node_Str"));
case L:
      return String.format("String_Node_Str",bundle.getString("String_Node_Str"),nominal.apply(on.getTime().getValue()),bundle.getString("String_Node_Str"));
default :
    return "String_Node_Str";
}
}
return "String_Node_Str";
}
);
return dow;
}
Program: 4249
Project: 4249
Buggy source:
@Override protected List<Integer> generateCandidatesNotIncludingIntervalExtremes(int start,int end){
  List<Integer> values=new ArrayList<>();
  try {
    int reference=generateNextValue(start);
    while (reference < end) {
      values.add(reference);
      reference=generateNextValue(reference);
    }
  }
 catch (  NoSuchValueException ignored) {
  }
  return values;
}

Fixed version (ground truth):
@Override protected List<Integer> generateCandidatesNotIncludingIntervalExtremes(int start,int end){
  List<Integer> values=new ArrayList<>();
  try {
    if (start != offset()) {
      values.add(offset());
    }
    int reference=generateNextValue(start);
    while (reference < end) {
      values.add(reference);
      reference=generateNextValue(reference);
    }
  }
 catch (  NoSuchValueException ignored) {
  }
  return values;
}
Program: 4250
Project: 4250
Buggy source:
@VisibleForTesting int offset(){
  return cronField.getConstraints().getStartRange();
}

Fixed version (ground truth):
@VisibleForTesting int offset(){
  FieldExpression expression=((Every)cronField.getExpression()).getExpression();
  if (expression instanceof On) {
    return ((On)expression).getTime().getValue();
  }
  return cronField.getConstraints().getStartRange();
}
Program: 4251
Project: 4251
Buggy source:
@Override public boolean isMatch(int value){
  Every every=(Every)cronField.getExpression();
  int start=cronField.getConstraints().getStartRange();
  return ((value - start) % every.getPeriod().getValue()) == 0;
}

Fixed version (ground truth):
@Override public boolean isMatch(int value){
  Every every=(Every)cronField.getExpression();
  int start=offset();
  return ((value - start) % every.getPeriod().getValue()) == 0;
}
Program: 4252
Project: 4252
Buggy source:
/** 
 * Issue #27: execution time properly calculated
 */
@Test public void testMonthRangeExecutionTime(){
  ExecutionTime.forCron(parser.parse("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Issue #27: execution time properly calculated
 */
@Test public void testMonthRangeExecutionTime(){
  assertNotNull(ExecutionTime.forCron(parser.parse("String_Node_Str")));
}
Program: 4253
Project: 4253
Buggy source:
@Test public void testTimeToNextExecution() throws Exception {
  ZonedDateTime now=truncateToSeconds(ZonedDateTime.now());
  ZonedDateTime expected=truncateToSeconds(now.plusSeconds(1));
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(EVERY_SECOND));
  assertEquals(java.time.Duration.between(now,expected),executionTime.timeToNextExecution(now));
}

Fixed version (ground truth):
@Test public void testTimeToNextExecution() throws Exception {
  ZonedDateTime now=truncateToSeconds(ZonedDateTime.now());
  ZonedDateTime expected=truncateToSeconds(now.plusSeconds(1));
  ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(EVERY_SECOND));
  assertEquals(Duration.between(now,expected),executionTime.timeToNextExecution(now));
}
Program: 4254
Project: 4254
Buggy source:
@Test public void testParseIncompleteEvery() throws Exception {
  Set<FieldDefinition> set=Sets.newHashSet();
  set.add(new FieldDefinition(CronFieldName.SECOND,FieldConstraintsBuilder.instance().createConstraintsInstance()));
  when(definition.getFieldDefinitions()).thenReturn(set);
  parser=new CronParser(definition);
  expectedException.expect(IllegalArgumentException.class);
  expectedException.expectMessage("String_Node_Str");
  parser.parse("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testParseIncompleteEvery() throws Exception {
  Set<FieldDefinition> set=Sets.newHashSet();
  set.add(new FieldDefinition(CronFieldName.SECOND,FieldConstraintsBuilder.instance().createConstraintsInstance()));
  when(definition.getFieldDefinitions()).thenReturn(set);
  parser=new CronParser(definition);
  expectedException.expect(IllegalArgumentException.class);
  expectedException.expectMessage("String_Node_Str");
  assertNotNull(parser.parse("String_Node_Str"));
}
Program: 4255
Project: 4255
Buggy source:
/** 
 * Issue #27: day of week range string mapping is valid
 */
@Test public void testDayOfWeekRangeMappingIsValid(){
  parser.parse("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Issue #27: day of week range string mapping is valid
 */
@Test public void testDayOfWeekRangeMappingIsValid(){
  assertNotNull(parser.parse("String_Node_Str"));
}
Program: 4256
Project: 4256
Buggy source:
@VisibleForTesting boolean isDefault(FieldValue<?> fieldValue){
  return fieldValue instanceof IntegerFieldValue && ((IntegerFieldValue)fieldValue).getValue() == -1;
}

Fixed version (ground truth):
@VisibleForTesting protected boolean isDefault(FieldValue<?> fieldValue){
  return fieldValue instanceof IntegerFieldValue && ((IntegerFieldValue)fieldValue).getValue() == -1;
}
Program: 4257
Project: 4257
Buggy source:
boolean isSpecialCharNotL(FieldValue<?> fieldValue){
  return fieldValue instanceof SpecialCharFieldValue && !SpecialChar.L.equals(fieldValue.getValue());
}

Fixed version (ground truth):
protected boolean isSpecialCharNotL(FieldValue<?> fieldValue){
  return fieldValue instanceof SpecialCharFieldValue && !SpecialChar.L.equals(fieldValue.getValue());
}
Program: 4258
Project: 4258
Buggy source:
/** 
 * Check if given number is greater or equal to start range and minor or equal to end range
 * @param fieldValue - to be validated
 * @throws IllegalArgumentException - if not in range
 */
@VisibleForTesting void isInRange(FieldValue<?> fieldValue){
  if (fieldValue instanceof IntegerFieldValue) {
    int value=((IntegerFieldValue)fieldValue).getValue();
    if (!constraints.isInRange(value)) {
      throw new IllegalArgumentException(String.format(OORANGE,value,constraints.getStartRange(),constraints.getEndRange()));
    }
  }
}

Fixed version (ground truth):
/** 
 * Check if given number is greater or equal to start range and minor or equal to end range
 * @param fieldValue - to be validated
 * @throws IllegalArgumentException - if not in range
 */
@VisibleForTesting protected void isInRange(FieldValue<?> fieldValue){
  if (fieldValue instanceof IntegerFieldValue) {
    int value=((IntegerFieldValue)fieldValue).getValue();
    if (!constraints.isInRange(value)) {
      throw new IllegalArgumentException(String.format(OORANGE,value,constraints.getStartRange(),constraints.getEndRange()));
    }
  }
}
Program: 4260
Project: 4260
Buggy source:
TimeNode generateDays(CronDefinition cronDefinition,ZonedDateTime date){
  boolean questionMarkSupported=cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
  if (questionMarkSupported) {
    return new TimeNode(generateDayCandidatesQuestionMarkSupported(date.getYear(),date.getMonthValue(),((DayOfWeekFieldDefinition)cronDefinition.getFieldDefinition(DAY_OF_WEEK)).getMondayDoWValue()));
  }
 else {
    return new TimeNode(generateDayCandidatesQuestionMarkNotSupported(date.getYear(),date.getMonthValue(),((DayOfWeekFieldDefinition)cronDefinition.getFieldDefinition(DAY_OF_WEEK)).getMondayDoWValue()));
  }
}

Fixed version (ground truth):
private TimeNode generateDays(CronDefinition cronDefinition,ZonedDateTime date){
  boolean questionMarkSupported=cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
  if (questionMarkSupported) {
    return new TimeNode(generateDayCandidatesQuestionMarkSupported(date.getYear(),date.getMonthValue(),((DayOfWeekFieldDefinition)cronDefinition.getFieldDefinition(DAY_OF_WEEK)).getMondayDoWValue()));
  }
 else {
    return new TimeNode(generateDayCandidatesQuestionMarkNotSupported(date.getYear(),date.getMonthValue(),((DayOfWeekFieldDefinition)cronDefinition.getFieldDefinition(DAY_OF_WEEK)).getMondayDoWValue()));
  }
}
Program: 4261
Project: 4261
Buggy source:
/** 
 * Creates execution time for given Cron
 * @param cron - Cron instance
 * @return ExecutionTime instance
 */
public static ExecutionTime forCron(Cron cron){
  Map<CronFieldName,CronField> fields=cron.retrieveFieldsAsMap();
  ExecutionTimeBuilder executionTimeBuilder=new ExecutionTimeBuilder(cron.getCronDefinition());
  for (  CronFieldName name : CronFieldName.values()) {
    if (fields.get(name) != null) {
switch (name) {
case SECOND:
        executionTimeBuilder.forSecondsMatching(fields.get(name));
      break;
case MINUTE:
    executionTimeBuilder.forMinutesMatching(fields.get(name));
  break;
case HOUR:
executionTimeBuilder.forHoursMatching(fields.get(name));
break;
case DAY_OF_WEEK:
executionTimeBuilder.forDaysOfWeekMatching(fields.get(name));
break;
case DAY_OF_MONTH:
executionTimeBuilder.forDaysOfMonthMatching(fields.get(name));
break;
case MONTH:
executionTimeBuilder.forMonthsMatching(fields.get(name));
break;
case YEAR:
executionTimeBuilder.forYearsMatching(fields.get(name));
break;
}
}
}
return executionTimeBuilder.build();
}

Fixed version (ground truth):
/** 
 * Creates execution time for given Cron
 * @param cron - Cron instance
 * @return ExecutionTime instance
 */
public static ExecutionTime forCron(Cron cron){
  Map<CronFieldName,CronField> fields=cron.retrieveFieldsAsMap();
  ExecutionTimeBuilder executionTimeBuilder=new ExecutionTimeBuilder(cron.getCronDefinition());
  for (  CronFieldName name : CronFieldName.values()) {
    if (fields.get(name) != null) {
switch (name) {
case SECOND:
        executionTimeBuilder.forSecondsMatching(fields.get(name));
      break;
case MINUTE:
    executionTimeBuilder.forMinutesMatching(fields.get(name));
  break;
case HOUR:
executionTimeBuilder.forHoursMatching(fields.get(name));
break;
case DAY_OF_WEEK:
executionTimeBuilder.forDaysOfWeekMatching(fields.get(name));
break;
case DAY_OF_MONTH:
executionTimeBuilder.forDaysOfMonthMatching(fields.get(name));
break;
case MONTH:
executionTimeBuilder.forMonthsMatching(fields.get(name));
break;
case YEAR:
executionTimeBuilder.forYearsMatching(fields.get(name));
break;
default :
break;
}
}
}
return executionTimeBuilder.build();
}