### Question:
LuceneAspspRepository implements AspspRepository { @Override public Optional<Aspsp> findById(String id) { logger.debug("Searching for ASPSPs: by ID [{}]", id); List<Aspsp> aspsps = find(new TermQuery(new Term(ID_FIELD_NAME, id)), null, 1); if (aspsps.isEmpty()) { return Optional.empty(); } return Optional.of(aspsps.get(0)); } LuceneAspspRepository(Directory directory); Aspsp save(Aspsp aspsp); @Override void deleteById(String aspspId); @Override void deleteAll(); @Override void saveAll(List<Aspsp> aspsps); @Override Optional<Aspsp> findById(String id); @Override List<Aspsp> findByBic(String bic, String after, int size); @Override List<Aspsp> findByBankCode(String bankCode, String after, int size); @Override List<Aspsp> findByName(String name, String after, int size); @Override List<Aspsp> findAll(String after, int size); @Override List<Aspsp> findLike(Aspsp aspsp, String after, int size); @Override List<Aspsp> findByIban(String iban, String after, int size);  }### Answer:
@Test void findByIdReturnsEmptyWhenIndexDoesntExist() { Optional<Aspsp> found = new LuceneAspspRepository(new ByteBuffersDirectory()).findById("id"); assertThat(found).isEmpty(); }
@Test void findById_NotFound() { Optional<Aspsp> found = luceneAspspRepository.findById("id"); assertThat(found).isEmpty(); }