### Question:
CronSchedules { public static String generateDailySchedule() { return random.nextInt(60) + " " + random.nextInt(60) + " " + random.nextInt(24) + " * * ? *"; } private  CronSchedules(); static String generateDailySchedule(); static String generateDailySchedule(int startHour, int endHour);  }### Answer:
@Test public void testGenerateDefaultDailySchedule() throws Exception { String cron = CronSchedules.generateDailySchedule(); testCommon(cron); String otherCron = CronSchedules.generateDailySchedule(); assertNotEquals(otherCron, cron); }
@Test public void testGenerateDailyScheduleInBounds() throws Exception { int startHour = 10; int endHour = 12; List<Integer> expectedHours = Arrays.asList(10, 11); String cron = CronSchedules.generateDailySchedule(startHour, endHour); testCommon(cron); testBounds(cron, expectedHours); String otherCron = CronSchedules.generateDailySchedule(); assertNotEquals(otherCron, cron); }
@Test public void testGenerateDailyScheduleInDifferentDaysBounds() throws Exception { int startHour = 22; int endHour = 5; List<Integer> expectedHours = Arrays.asList(22, 23, 0, 1, 2, 3, 4); String cron = CronSchedules.generateDailySchedule(startHour, endHour); testCommon(cron); testBounds(cron, expectedHours); String otherCron = CronSchedules.generateDailySchedule(); assertNotEquals(otherCron, cron); }
@Test(expected = IllegalArgumentException.class) public void testStartHourEqualsEndHour() throws Exception { CronSchedules.generateDailySchedule(5, 5); }
@Test(expected = IllegalArgumentException.class) public void testIncorrectStartHour() throws Exception { CronSchedules.generateDailySchedule(25, 3); }
@Test(expected = IllegalArgumentException.class) public void testIncorrectEndHour() throws Exception { CronSchedules.generateDailySchedule(8, -1); }