@Test public void shouldExecuteReturnsFalseWhenLastExecuteLessThanRefreshIntervalMinutesAgo() { var minutesAgo = REFRESH_INTERVAL - 1L; var lastExecuteTime = LocalDateTime.now(clock).plus(minutesAgo, ChronoUnit.MINUTES); var actualShouldUpdate = projectUpdater.shouldExecute(lastExecuteTime); assertThat(actualShouldUpdate).isFalse(); }
@Override public boolean shouldExecute(LocalDateTime lastExecuteTime) { Duration lastUpdateDeltaDuration = Duration.between(lastExecuteTime, LocalDateTime.now(clock)).abs(); return refreshIntervalDuration.compareTo(lastUpdateDeltaDuration) <= 0; }
ProjectUpdater implements ScheduledJob { @Override public boolean shouldExecute(LocalDateTime lastExecuteTime) { Duration lastUpdateDeltaDuration = Duration.between(lastExecuteTime, LocalDateTime.now(clock)).abs(); return refreshIntervalDuration.compareTo(lastUpdateDeltaDuration) <= 0; } }
ProjectUpdater implements ScheduledJob { @Override public boolean shouldExecute(LocalDateTime lastExecuteTime) { Duration lastUpdateDeltaDuration = Duration.between(lastExecuteTime, LocalDateTime.now(clock)).abs(); return refreshIntervalDuration.compareTo(lastUpdateDeltaDuration) <= 0; } @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          @Lazy List<Normalizer<Project>> normalizers,
                          Clock clock); @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          Clock clock); }
ProjectUpdater implements ScheduledJob { @Override public boolean shouldExecute(LocalDateTime lastExecuteTime) { Duration lastUpdateDeltaDuration = Duration.between(lastExecuteTime, LocalDateTime.now(clock)).abs(); return refreshIntervalDuration.compareTo(lastUpdateDeltaDuration) <= 0; } @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          @Lazy List<Normalizer<Project>> normalizers,
                          Clock clock); @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          Clock clock); @Override void execute(LocalDateTime lastExecuteTime); @Override void execute(); @Override String getJobIdentifier(); @Override boolean shouldExecute(LocalDateTime lastExecuteTime); }
ProjectUpdater implements ScheduledJob { @Override public boolean shouldExecute(LocalDateTime lastExecuteTime) { Duration lastUpdateDeltaDuration = Duration.between(lastExecuteTime, LocalDateTime.now(clock)).abs(); return refreshIntervalDuration.compareTo(lastUpdateDeltaDuration) <= 0; } @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          @Lazy List<Normalizer<Project>> normalizers,
                          Clock clock); @Autowired(required = false)  ProjectUpdater(ProjectService projectService,
                          ProjectReader projectReader,
                          ProjectBoardConfigurationProperties properties,
                          Clock clock); @Override void execute(LocalDateTime lastExecuteTime); @Override void execute(); @Override String getJobIdentifier(); @Override boolean shouldExecute(LocalDateTime lastExecuteTime);  }