CrontabEntry { public static CrontabEntry parse(String schedule) throws IllegalArgumentException { return new Parser(schedule).get(); } private  CrontabEntry(
      RangeSet<Integer> minute,
      RangeSet<Integer> hour,
      RangeSet<Integer> dayOfMonth,
      RangeSet<Integer> month,
      RangeSet<Integer> dayOfWeek); static CrontabEntry parse(String schedule); static Optional<CrontabEntry> tryParse(String schedule); RangeSet<Integer> getDayOfWeek(); boolean hasWildcardDayOfMonth(); boolean hasWildcardDayOfWeek(); String getMinuteAsString(); String getHourAsString(); String getDayOfMonthAsString(); String getMonthAsString(); String getDayOfWeekAsString(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testHashCodeAndEquals() { List<CrontabEntry> entries = ImmutableList.of( CrontabEntry.parse("* * * * *"), CrontabEntry.parse("0-59 * * * *"), CrontabEntry.parse("0-57,58,59 * * * *"), CrontabEntry.parse("* 23,1,2,4,0-22 * * *"), CrontabEntry.parse("1-50,0,51-59 * * * sun-sat")); for (CrontabEntry lhs : entries) { for (CrontabEntry rhs : entries) { assertEquals(lhs, rhs); } } assertEquals(1, ImmutableSet.copyOf(entries).size()); }
@Test public void testEqualsCoverage() { assertNotEquals(CrontabEntry.parse("* * * * *"), new Object()); assertNotEquals(CrontabEntry.parse("* * * * *"), CrontabEntry.parse("1 * * * *")); assertEquals(CrontabEntry.parse("1,2,3 * * * *"), CrontabEntry.parse("1-3 * * * *")); assertNotEquals(CrontabEntry.parse("* 0-22 * * *"), CrontabEntry.parse("* * * * *")); assertEquals(CrontabEntry.parse("* 0-23 * * *"), CrontabEntry.parse("* * * * *")); assertNotEquals(CrontabEntry.parse("1 1 1-30 * *"), CrontabEntry.parse("1 1 * * *")); assertEquals(CrontabEntry.parse("1 1 1-31 * *"), CrontabEntry.parse("1 1 * * *")); assertNotEquals(CrontabEntry.parse("1 1 * JAN,FEB-NOV *"), CrontabEntry.parse("1 1 * * *")); assertEquals(CrontabEntry.parse("1 1 * JAN,FEB-DEC *"), CrontabEntry.parse("1 1 * * *")); assertNotEquals(CrontabEntry.parse("* * * * SUN"), CrontabEntry.parse("* * * * SAT")); assertEquals(CrontabEntry.parse("* * * * 0"), CrontabEntry.parse("* * * * SUN")); }
@Test public void testSkip() { assertEquals(CrontabEntry.parse("*/15 * * * *"), CrontabEntry.parse("0,15,30,45 * * * *")); assertEquals( CrontabEntry.parse("* */2 * * *"), CrontabEntry.parse("0-59 0,2,4,6,8,10,12-23/2 * * *")); }