### Question:
IndexerForSearchSelector { protected boolean checkIndexerStatus(Indexer indexer) { if (indexer.getConfig().getState() == IndexerConfig.State.DISABLED_SYSTEM_TEMPORARY) { if (indexer.getConfig().getDisabledUntil() == null || Instant.ofEpochMilli(indexer.getConfig().getDisabledUntil()).isBefore(clock.instant())) { return true; } String message = String.format("Not using %s because it's disabled until %s due to a previous error ", indexer.getName(), Instant.ofEpochMilli(indexer.getConfig().getDisabledUntil())); return handleIndexerNotSelected(indexer, message, "Disabled temporarily because of previous errors"); } if (indexer.getConfig().getState() == IndexerConfig.State.DISABLED_SYSTEM) { String message = String.format("Not using %s because it's disabled due to a previous unrecoverable error", indexer.getName()); return handleIndexerNotSelected(indexer, message, "Disabled permanently because of previous unrecoverable error"); } return true; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); static final Pattern SCHEDULER_PATTERN; }### Answer:
@Test public void shouldCheckIfDisabledBySystem() { when(searchingConfig.isIgnoreTemporarilyDisabled()).thenReturn(false); indexerConfigMock.setState(IndexerConfig.State.ENABLED); indexerConfigMock.setDisabledUntil(null); assertTrue(testee.checkIndexerStatus(indexer)); indexerConfigMock.setState(IndexerConfig.State.DISABLED_SYSTEM_TEMPORARY); indexerConfigMock.setDisabledUntil(Instant.now().plus(1, ChronoUnit.DAYS).toEpochMilli()); assertFalse(testee.checkIndexerStatus(indexer)); indexerConfigMock.setState(IndexerConfig.State.DISABLED_SYSTEM); assertFalse(testee.checkIndexerStatus(indexer)); }