CrontabEntry { public static Optional<CrontabEntry> tryParse(String schedule) { try { return Optional.of(parse(schedule)); } catch (IllegalArgumentException e) { return Optional.absent(); } } 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 testBadEntries() { List<String> badPatterns = ImmutableList.of( "* * * * MON-SUN", "* * **", "0-59 0-59 * * *", "1/1 * * * *", "5 5 * MAR-JAN *", "*/0 * * * *", "0-59/0 * * * *", "0-59/60 * * * *", "* * 1 * 1" ); for (String pattern : badPatterns) { assertNull(CrontabEntry.tryParse(pattern).orNull()); } }