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