@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()); }
public KerberosConfig get(String environmentCrn) { String accountId = crnService.getCurrentAccountId(); return kerberosConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(accountId, environmentCrn) .orElseThrow(notFound("KerberosConfig for environment", environmentCrn)); }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig get(String environmentCrn) { String accountId = crnService.getCurrentAccountId(); return kerberosConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(accountId, environmentCrn) .orElseThrow(notFound("KerberosConfig for environment", environmentCrn)); } }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig get(String environmentCrn) { String accountId = crnService.getCurrentAccountId(); return kerberosConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(accountId, environmentCrn) .orElseThrow(notFound("KerberosConfig for environment", environmentCrn)); }  }
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(); }
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();  }