@Test public void testCreateKerberosConfigWhenThereIsAlreadyExisted() { KerberosConfig kerberosConfig = new KerberosConfig(); kerberosConfig.setEnvironmentCrn(ENVIRONMENT_ID); Mockito.when(crnService.getCurrentAccountId()).thenReturn(ACCOUNT_ID); Mockito.when(kerberosConfigRepository.findByAccountIdAndEnvironmentCrnAndClusterNameIsNullAndArchivedIsFalse(ACCOUNT_ID, ENVIRONMENT_ID)) .thenReturn(Optional.of(new KerberosConfig())); BadRequestException ex = Assertions.assertThrows(BadRequestException.class, () -> { underTest.createKerberosConfig(kerberosConfig); }); assertEquals("KerberosConfig in the [accountId] account's [environmentId] environment is already exists", ex.getMessage()); }
public KerberosConfig createKerberosConfig(KerberosConfig kerberosConfig) { String accountId = crnService.getCurrentAccountId(); return createKerberosConfig(kerberosConfig, accountId); }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig createKerberosConfig(KerberosConfig kerberosConfig) { String accountId = crnService.getCurrentAccountId(); return createKerberosConfig(kerberosConfig, accountId); } }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig createKerberosConfig(KerberosConfig kerberosConfig) { String accountId = crnService.getCurrentAccountId(); return createKerberosConfig(kerberosConfig, accountId); }  }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig createKerberosConfig(KerberosConfig kerberosConfig) { String accountId = crnService.getCurrentAccountId(); return createKerberosConfig(kerberosConfig, 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(); }
KerberosConfigService extends AbstractArchivistService<KerberosConfig> { public KerberosConfig createKerberosConfig(KerberosConfig kerberosConfig) { String accountId = crnService.getCurrentAccountId(); return createKerberosConfig(kerberosConfig, 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();  }