MaintenanceScheduleHelper { public static void validateCronSchedule(final String cronSchedule) { try { if (StringUtils.hasText(cronSchedule)) { getCronFromExpression(cronSchedule); } } catch (final IllegalArgumentException e) { throw new InvalidMaintenanceScheduleException(e.getMessage(), e); } } private  MaintenanceScheduleHelper(); @SuppressWarnings("squid:S1166") static Optional<ZonedDateTime> getNextMaintenanceWindow(final String cronSchedule, final String duration,
            final String timezone); static Cron getCronFromExpression(final String cronSchedule); static void validateMaintenanceSchedule(final String cronSchedule, final String duration,
            final String timezone); static Duration convertToISODuration(final String timeInterval); static void validateDuration(final String duration); static void validateCronSchedule(final String cronSchedule);  }
@Test @Description("Verifies that the InvalidMaintenanceScheduleException is thrown for invalid cron expression") public void validateCronScheduleInvalid() { final String invalidCron = "0 0 0 * * 6"; assertThatThrownBy(() -> MaintenanceScheduleHelper.validateCronSchedule(invalidCron)) .isInstanceOf(InvalidMaintenanceScheduleException.class) .hasMessageContaining("Both, a day-of-week AND a day-of-month parameter, are not supported"); }