### Question:
AlertValidator { public void validateSchedule(TimeAlertRequest json) { try { dateService.validateTimeZone(json.getTimeZone()); dateService.getCronExpression(json.getCron()); } catch (ParseException parseException) { throw new BadRequestException(parseException.getMessage(), parseException); } }  void validateEntitlementAndDisableIfNotEntitled(Cluster cluster); void validateSupportedHostGroup(Cluster cluster, Set<String> requestHostGroups, AlertType alertType); void validateDistroXAutoscaleClusterRequest(Cluster cluster,
            DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest); void validateSchedule(TimeAlertRequest json);  }### Answer:
@Test public void testValidateScheduleWhenValidThenSuccess() { TimeAlertRequest request = new TimeAlertRequest(); request.setCron("1 0 1 1 1 1"); request.setTimeZone("GMT"); underTest.validateSchedule(request); }
@Test public void testValidateScheduleWhenInvalidCron() { TimeAlertRequest request = new TimeAlertRequest(); request.setCron("2 22 22243 333"); expectedException.expect(BadRequestException.class); expectedException.expectMessage("Range exceeds maximum"); underTest.validateSchedule(request); }
@Test public void testValidateScheduleWhenInvalidTimeZone() { TimeAlertRequest request = new TimeAlertRequest(); request.setCron("1 0 1 1 1 1"); request.setTimeZone("GMT-4343"); expectedException.expect(BadRequestException.class); expectedException.expectMessage("Invalid ID for offset-based ZoneId: GMT-4343"); underTest.validateSchedule(request); }