MaintenanceScheduler { @Scheduled(cron = "${maintenance.scheduled.cron}") public void launchNightlyTask() { runMaintenanceTask(NIGHT); }  @PostConstruct void launchOnceTask(); @Scheduled(cron = "${maintenance.scheduled.cron}") void launchNightlyTask(); @Scheduled(fixedDelayString = "${maintenance.scheduled.fixed-delay}", initialDelayString = "${maintenance.scheduled.initial-delay}") void launchRepeatlyTask();  }
@Test public void testScheduleNight() { scheduler.launchNightlyTask(); verify(listTask.get(2), times(1)).performTask(); verify(listTask.get(3), times(0)).performTask(); verify(listTask.get(6), times(1)).performTask(); listTask .stream() .filter(task -> !(task instanceof MockScheduledNightlyTask)) .forEach(task -> { verify(task, times(0)).performTask(); verify(task, times(0)).condition(); verify(task, times(0)).execute(); }); }