### Question:
AuthorityService implements IAuthorityService { @Override public IAuthorityEntry find(String id) { Optional<AuthorityEntry> entryOptional = entryRepository.findById(id); if (entryOptional.isPresent()) { return entryOptional.get(); } return null; }  @Override void register(AuthorityImporter importer); @Override IAuthorityEntry importAuthority(String uri); @Override IAuthorityEntry find(String id); @Override List<IAuthorityEntry> findByUri(IUser user, String uri); @Override Set<IAuthorityEntry> findByUriInDataset(String uri, String citationGroupId); @Override boolean deleteAuthority(String id); @Override List<IAuthorityEntry> getAll(IUser user); @Override IAuthorityEntry create(IAuthorityEntry entry, IUser user); @Override IAuthorityEntry save(IAuthorityEntry entry);  }### Answer:
@Test public void test_find_success() { String id = "ID"; String name = "name"; AuthorityEntry entry = new AuthorityEntry(); entry.setId(id); entry.setName(name); Mockito.when(entryRepository.findById(id)).thenReturn(Optional.of(entry)); IAuthorityEntry actualEntry = managerToTest.find(id); Assert.assertEquals(id, actualEntry.getId()); Assert.assertEquals(name, actualEntry.getName()); }
@Test public void test_find_failure() { String id = "ID"; Mockito.when(entryRepository.findById(id)).thenReturn(Optional.empty()); IAuthorityEntry actualEntry = managerToTest.find(id); Assert.assertNull(actualEntry); }