import org.springframework.http.HttpStatus;
@ExtendWith(MockitoExtension.class)
-public class ReadinessControllerTest {
+class ReadinessControllerTest {
@Mock
private CmpServersConfig cmpServersConfig;
@Test
- public void shouldReturnStatusOkWhenConfigIsReady() {
+ void shouldReturnStatusOkWhenConfigIsReady() {
// Given
Mockito.when(cmpServersConfig.isReady()).thenReturn(true);
// Then
assertThat(new ReadinessController(cmpServersConfig).checkReady().getStatusCode()).isEqualTo(HttpStatus.OK);
- ;
}
@Test
- public void shouldReturnStatusServiceUnavailableWhenConfigIsNotReady() {
+ void shouldReturnStatusServiceUnavailableWhenConfigIsNotReady() {
// Given
Mockito.when(cmpServersConfig.isReady()).thenReturn(false);
// Then
assertThat(new ReadinessController(cmpServersConfig).checkReady().getStatusCode()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
- ;
}
}
import static org.assertj.core.api.Assertions.assertThat;
import static org.onap.oom.certservice.certification.TestUtils.createCsrModel;
-public class X509CertificateBuilderTest {
+class X509CertificateBuilderTest {
private X509CertificateBuilder certificateBuilder;
}
@Test
- public void shouldReportThatSystemEnvOuVariableIsNotPresentWhenItWasNotDefined() {
+ void shouldReportThatSystemEnvOuVariableIsNotPresentWhenItWasNotDefined() {
// when
final Optional<String> testEnv = envsForCsr.getOrganizationUnit();
}
@Test
- public void shouldReportThatSystemEnvSansVariableIsNotPresentWhenItWasNotDefined() {
+ void shouldReportThatSystemEnvSansVariableIsNotPresentWhenItWasNotDefined() {
// when
final Optional<String> testEnv = envsForCsr.getSubjectAlternativesName();
public class CertificateConstants {
+ private CertificateConstants() { }
+
public static final String JKS_TYPE = "JKS";
public static final String PKCS12_TYPE = "PKCS12";
public static final String X_509_CERTIFICATE = "X.509";
import static org.onap.oom.certservice.postprocessor.api.CertificateConstants.PKCS12_TYPE;
import java.io.File;
-import org.onap.oom.certservice.postprocessor.merger.exception.KeystoreInstanceException;
-import org.onap.oom.certservice.postprocessor.merger.exception.LoadTruststoreException;
-import org.onap.oom.certservice.postprocessor.merger.exception.PasswordReaderException;
import org.onap.oom.certservice.postprocessor.common.ExtensionResolver;
import org.onap.oom.certservice.postprocessor.merger.exception.TruststoreFileFactoryException;
private TruststoreFactory() {
}
- public static Truststore create(String truststoreFilePath, String truststorePasswordPath)
- throws TruststoreFileFactoryException, PasswordReaderException, KeystoreInstanceException, LoadTruststoreException {
+ public static Truststore create(String truststoreFilePath, String truststorePasswordPath) {
File truststoreFile = new File(truststoreFilePath);
if (!ExtensionResolver.checkIfFileExists(truststoreFile)) {
throw new TruststoreFileFactoryException(String.format(FILE_DOES_NOT_EXIST_MSG_TEMPLATE, truststoreFile));
return createTypedTruststore(truststoreFile, truststorePasswordPath);
}
- private static Truststore createTypedTruststore(File truststoreFile, String truststorePasswordPath)
- throws KeystoreInstanceException, PasswordReaderException, LoadTruststoreException, TruststoreFileFactoryException {
+ private static Truststore createTypedTruststore(File truststoreFile, String truststorePasswordPath) {
String extension = ExtensionResolver.get(truststoreFile);
switch (extension) {
case JKS_EXTENSION:
import org.onap.oom.certservice.postprocessor.merger.exception.AliasConflictException;
@ExtendWith(MockitoExtension.class)
-public class AppExecutorTest {
+class AppExecutorTest {
@Mock
Runnable logic;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
-public class FileToolsTest {
+class FileToolsTest {
public static final String BAK_EXTENSION = ".bak";
//when
new FileTools().createBackup(fileToBackup);
//then
- assertThat(fileToBackup.equals(new File(backupFilePath)));
+ assertThat(fileToBackup).hasSameBinaryContentAs(new File(backupFilePath));
}
@Test
//when
new FileTools().copy(sourceFile, destinationFile);
//then
- assertThat(sourceFile.equals(destinationFile));
+ assertThat(sourceFile).hasSameBinaryContentAs(destinationFile);
}
//when
String alias = pemAliasGenerator.getAlias();
//then
- assertThat(alias.contains(PREFIX_ALIAS_NAME)).isTrue();
+ assertThat(alias).contains(PREFIX_ALIAS_NAME);
}
@Test