@Test public void executeWithTimeSavesAllProjectsSince() throws Exception { var lastExecuteTime = LocalDateTime.now(clock); var expectedProjects = List.of(projectMock); given(projectReaderMock.getAllProjectsSince(lastExecuteTime)) .willReturn(expectedProjects); given(normalizerMock.normalize(expectedProjects)) .willReturn(expectedProjects); projectUpdater.execute(lastExecuteTime); verify(projectServiceMock).saveAll(projectListCaptor.capture()); var actualProjects = projectListCaptor.getValue(); assertThat(actualProjects).containsExactlyElementsOf(expectedProjects); }
@Override public void execute(LocalDateTime lastExecuteTime) throws Exception { var projects = projectReader.getAllProjectsSince(lastExecuteTime); normalizeAndSave(projects); }
ProjectUpdater implements ScheduledJob { @Override public void execute(LocalDateTime lastExecuteTime) throws Exception { var projects = projectReader.getAllProjectsSince(lastExecuteTime); normalizeAndSave(projects); } }
ProjectUpdater implements ScheduledJob { @Override public void execute(LocalDateTime lastExecuteTime) throws Exception { var projects = projectReader.getAllProjectsSince(lastExecuteTime); normalizeAndSave(projects); } @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 void execute(LocalDateTime lastExecuteTime) throws Exception { var projects = projectReader.getAllProjectsSince(lastExecuteTime); normalizeAndSave(projects); } @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 void execute(LocalDateTime lastExecuteTime) throws Exception { var projects = projectReader.getAllProjectsSince(lastExecuteTime); normalizeAndSave(projects); } @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);  }