### Question:
DefectService { boolean needFullIndexing(Long projectId, Date now) { return lastFullIndexDates.get(projectId) == null || lastIncrementalIndexDates.get(projectId) == null || diffHours(now, lastFullIndexDates.get(projectId)) >= 1; }  Optional<DefectAdapter> getAdapter(long projectId); List<DefectAdapter> getAdapters(); @Scheduled(fixedDelayString = "${ara.defectSyncSchedulingDelayInMilliseconds}", initialDelayString = "${ara.defectSyncSchedulingInitialDelayInMilliseconds}") @Transactional void updateStatuses(); @Transactional void fullIndex(Project project, DefectAdapter defectAdapter); @Transactional void incrementalIndex(Project project, DefectAdapter defectAdapter, Date since); @Transactional void refreshDefectExistences(long projectId);  }### Answer:
@Test public void needFullIndexing_should_return_true_if_no_full_index_done_yet() { final Long projectId = Long.valueOf(12); final Date lastIncrementalIndexDate = new Date(); cut.lastIncrementalIndexDates.put(projectId, lastIncrementalIndexDate); final boolean needing = cut.needFullIndexing(projectId, new Date()); assertThat(needing).isTrue(); }
@Test public void needFullIndexing_should_return_true_if_no_incremental_index_done_yet_because_there_is_no_baseline_date() { final Long projectId = Long.valueOf(12); final Date lastFullIndexDate = new Date(); cut.lastFullIndexDates.put(projectId, lastFullIndexDate); final boolean needing = cut.needFullIndexing(projectId, new Date()); assertThat(needing).isTrue(); }