ParameterUtil { public static String toParameter(Schedule schedule, Instant instant) { switch (schedule.wellKnown()) { case DAILY: case WEEKLY: return formatDate(instant); case HOURLY: return formatDateHour(instant); case MONTHLY: return formatMonth(instant); case YEARLY: return formatYear(instant); default: return formatDateTime(instant); } } private  ParameterUtil(); static Instant parseDate(String date); static Instant parseDateHour(String dateHour); static Instant parseDateMonth(String dateMonth); static Instant parseDateYear(String dateYear); static String toParameter(Schedule schedule, Instant instant); static Timestamp parseBest(String value); static Instant parseAlignedInstant(String dateHour, Schedule schedule);  }
@Test public void testToParameter() { assertThat(ParameterUtil.toParameter(HOURS, TIME), is("2016-01-19T09")); assertThat(ParameterUtil.toParameter(DAYS, TIME), is("2016-01-19")); assertThat(ParameterUtil.toParameter(WEEKS, TIME), is("2016-01-19")); assertThat(ParameterUtil.toParameter(MONTHS, TIME), is("2016-01")); assertThat(ParameterUtil.toParameter(YEARS, TIME), is("2016")); assertThat(ParameterUtil.toParameter(Schedule.parse("0 * * * *"), TIME), is("2016-01-19T09:11:00Z")); }