### Question:
SingleKeySequenceSelector implements KeySequenceSelector { @Override public final KeySequence firstAvailable() { if (repository == null) { throw new IllegalStateException(KeySequenceConfigRepository.class.getSimpleName() + " was not provided for " + SingleKeySequenceSelector.class.getSimpleName()); } KeySequence keySequence = current.get(); if (keySequence != null) { LOG.debug("Reusing current key sequence: {}", keySequence.getConfig(true)); repository.persist(keySequence.getConfig(true)); return keySequence; } KeySequenceConfig existing = findMatchingKeySequenceConfig(); if (existing == null) { KeySequenceConfig newConfig = createKeySequenceConfig(sequenceId); LOG.info("No matching keys sequences found. Creating new {}", newConfig.getKey()); setCurrent(newConfig); return current.get(); } if (isExpired(existing) || isOwned(existing)) { LOG.info("Reusing expired key sequence: {}", existing.getKey()); setCurrent(existing); } return current.get(); } SingleKeySequenceSelector(long sequenceId); SingleKeySequenceSelector withRepository(KeySequenceConfigRepository keySequenceConfigRepository); @Override void close(); @Override Supplier<KeySequence> currentKeySequence(); @Override final KeySequence firstAvailable();  }### Answer:
@Test public void throwsWhenRepositoryNotSet() { SingleKeySequenceSelector keySequenceSelector = new SingleKeySequenceSelector(DEFAULT_TEST_SEQUENCE_ID); expectedException.expect(IllegalStateException.class); expectedException.expectMessage(KeySequenceConfigRepository.class.getSimpleName() + " was not provided for " + SingleKeySequenceSelector.class.getSimpleName()); keySequenceSelector.firstAvailable(); }