diff options
Diffstat (limited to 'aai-schema-service')
3 files changed, 26 insertions, 18 deletions
diff --git a/aai-schema-service/pom.xml b/aai-schema-service/pom.xml index a5ef621..eaef1e0 100644 --- a/aai-schema-service/pom.xml +++ b/aai-schema-service/pom.xml @@ -327,11 +327,6 @@ <artifactId>logback-access</artifactId> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> @@ -401,12 +396,28 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-junit</artifactId> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> </dependency> </dependencies> <build> diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java index c687a58..49c3c33 100644 --- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java +++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java @@ -20,17 +20,16 @@ package org.onap.aai.schemaservice; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import java.io.UnsupportedEncodingException; import java.util.Base64; import java.util.Collections; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.exceptions.AAIException; import org.onap.aai.schemaservice.config.PropertyPasswordConfiguration; import org.onap.aai.util.AAIConfig; @@ -45,7 +44,6 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate; @SpringBootTest( @@ -54,8 +52,6 @@ import org.springframework.web.client.RestTemplate; @TestPropertySource(locations = "classpath:application-test.properties") @ContextConfiguration(initializers = PropertyPasswordConfiguration.class) @Import(SchemaServiceTestConfiguration.class) - -@RunWith(SpringRunner.class) public class SchemaServiceTest { private HttpHeaders headers; @@ -72,14 +68,14 @@ public class SchemaServiceTest { @LocalServerPort protected int randomPort; - @BeforeClass + @BeforeAll public static void setupConfig() throws AAIException { System.setProperty("AJSC_HOME", "./"); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/"); System.out.println("Current directory: " + System.getProperty("user.dir")); } - @Before + @BeforeEach public void setup() throws AAIException, UnsupportedEncodingException { AAIConfig.init(); diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java index 938d509..e5a8632 100644 --- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java +++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java @@ -38,6 +38,7 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; @@ -63,7 +64,7 @@ public class SchemaServiceTestConfiguration { RestTemplate restTemplate = null; - if (env.acceptsProfiles("one-way-ssl", "two-way-ssl")) { + if (env.acceptsProfiles(Profiles.of("one-way-ssl", "two-way-ssl"))) { char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray(); char[] keyStorePassword = @@ -73,7 +74,7 @@ public class SchemaServiceTestConfiguration { String trustStore = env.getProperty("server.ssl.trust-store"); SSLContextBuilder sslContextBuilder = SSLContextBuilder.create(); - if (env.acceptsProfiles("two-way-ssl")) { + if (env.acceptsProfiles(Profiles.of("two-way-ssl"))) { sslContextBuilder = sslContextBuilder .loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword); } |