@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); }
public void validateSchedule(TimeAlertRequest json) { try { dateService.validateTimeZone(json.getTimeZone()); dateService.getCronExpression(json.getCron()); } catch (ParseException parseException) { throw new BadRequestException(parseException.getMessage(), parseException); } }
AlertValidator { public void validateSchedule(TimeAlertRequest json) { try { dateService.validateTimeZone(json.getTimeZone()); dateService.getCronExpression(json.getCron()); } catch (ParseException parseException) { throw new BadRequestException(parseException.getMessage(), parseException); } } }
AlertValidator { public void validateSchedule(TimeAlertRequest json) { try { dateService.validateTimeZone(json.getTimeZone()); dateService.getCronExpression(json.getCron()); } catch (ParseException parseException) { throw new BadRequestException(parseException.getMessage(), parseException); } }  }
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); }
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);  }