### Question:
IndexerForSearchSelector { LocalDateTime calculateNextPossibleHit(IndexerConfig indexerConfig, Instant firstInWindowAccessTime) { LocalDateTime nextPossibleHit; if (indexerConfig.getHitLimitResetTime().isPresent()) { LocalDateTime now = LocalDateTime.now(clock); nextPossibleHit = now.with(ChronoField.HOUR_OF_DAY, indexerConfig.getHitLimitResetTime().get()).with(ChronoField.MINUTE_OF_HOUR, 0); if (nextPossibleHit.isBefore(now)) { nextPossibleHit = nextPossibleHit.plus(1, ChronoUnit.DAYS); } } else { nextPossibleHit = LocalDateTime.ofInstant(firstInWindowAccessTime, ZoneOffset.UTC).plus(1, ChronoUnit.DAYS); } return nextPossibleHit; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); static final Pattern SCHEDULER_PATTERN; }### Answer:
@Test public void shouldCalculateNextHitWithRollingTimeWindows() throws Exception { indexerConfigMock.setHitLimitResetTime(null); Instant firstInWindow = Instant.now().minus(12, ChronoUnit.HOURS); LocalDateTime nextHit = testee.calculateNextPossibleHit(indexerConfigMock, firstInWindow); assertEquals(LocalDateTime.ofInstant(firstInWindow, ZoneOffset.UTC).plus(24, ChronoUnit.HOURS), nextHit); }
@Test public void shouldCalculateNextHitWithFixedResetTime() { Instant currentTime = Instant.ofEpochSecond(1518500323); testee.clock = Clock.fixed(currentTime, ZoneId.of("UTC")); indexerConfigMock.setHitLimitResetTime(10); LocalDateTime nextHit = testee.calculateNextPossibleHit(indexerConfigMock, currentTime); assertThat(nextHit.getHour()).isEqualTo(10); assertThat(nextHit.getDayOfYear()).isEqualTo(LocalDateTime.ofInstant(currentTime, ZoneId.of("UTC")).get(ChronoField.DAY_OF_YEAR)); currentTime = Instant.ofEpochSecond(1518500323); testee.clock = Clock.fixed(currentTime, ZoneId.of("UTC")); indexerConfigMock.setHitLimitResetTime(4); nextHit = testee.calculateNextPossibleHit(indexerConfigMock, currentTime); assertThat(nextHit.getHour()).isEqualTo(4); assertThat(nextHit.getDayOfYear()).isEqualTo(LocalDateTime.ofInstant(currentTime, ZoneId.of("UTC")).get(ChronoField.DAY_OF_YEAR) + 1); }