### Question:
LdapConfigService extends AbstractArchivistService<LdapConfig> { public LdapConfig get(String environmentCrn) { String accountId = crnService.getCurrentAccountId(); return ldapConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(accountId, environmentCrn) .orElseThrow(notFound("LdapConfig for environment", environmentCrn)); }  LdapConfig createLdapConfig(LdapConfig ldapConfig); LdapConfig createLdapConfig(LdapConfig ldapConfig, String accountId); LdapConfig get(String environmentCrn); List<LdapConfig> findAllByEnvironmentAndAccountIdEvenIfArchived(String environmentCrn, String accountId); Optional<LdapConfig> find(String environmentCrn, String accountId, String clusterName); void delete(String environmentCrn); void delete(String environmentCrn, String accountId); void delete(String environmentCrn, String accountId, String clusterName); void deleteAllInEnvironment(String environmentCrn, String accountId); String testConnection(String environmentCrn, LdapConfig ldapConfig); @Override JpaRepository repository();  }### Answer:
@Test public void testGet() { LdapConfig expectedLdapConfig = new LdapConfig(); Mockito.when(crnService.getCurrentAccountId()).thenReturn(ACCOUNT_ID); Mockito.when(ldapConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(ACCOUNT_ID, ENVIRONMENT_ID)) .thenReturn(Optional.of(expectedLdapConfig)); LdapConfig actualResult = underTest.get(ENVIRONMENT_ID); assertEquals(expectedLdapConfig, actualResult); }
@Test public void testGetNotFound() { Mockito.when(crnService.getCurrentAccountId()).thenReturn(ACCOUNT_ID); NotFoundException ex = Assertions.assertThrows(NotFoundException.class, () -> { underTest.get(ENVIRONMENT_ID); }); assertEquals("LdapConfig for environment 'environmentId' not found.", ex.getMessage()); }