### Question:
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public void delete(String environmentCrn) { String accountId = crnService.getCurrentAccountId(); delete(environmentCrn, accountId); }  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 testDelete() { KerberosConfig expectedKerberosConfig = new KerberosConfig(); Mockito.when(crnService.getCurrentAccountId()).thenReturn(ACCOUNT_ID); Mockito.when(kerberosConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(ACCOUNT_ID, ENVIRONMENT_ID)) .thenReturn(Optional.of(expectedKerberosConfig)); underTest.delete(ENVIRONMENT_ID); Mockito.verify(kerberosConfigRepository).save(expectedKerberosConfig); }
@Test public void testDeleteNotFound() { Mockito.when(crnService.getCurrentAccountId()).thenReturn(ACCOUNT_ID); NotFoundException ex = Assertions.assertThrows(NotFoundException.class, () -> { underTest.delete(ENVIRONMENT_ID); }); assertEquals("KerberosConfig for environment 'environmentId' not found.", ex.getMessage()); }