diff options
Diffstat (limited to 'aai-utils')
-rw-r--r-- | aai-utils/pom.xml | 21 | ||||
-rw-r--r-- | aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java | 30 |
2 files changed, 30 insertions, 21 deletions
diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml index f5bc33f6..2ce63f68 100644 --- a/aai-utils/pom.xml +++ b/aai-utils/pom.xml @@ -88,11 +88,22 @@ <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-junit</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> diff --git a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java index f3b9f621..bcfdbebc 100644 --- a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java +++ b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java @@ -20,35 +20,33 @@ package org.onap.aaiutils.oxm; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.regex.Pattern; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class OxmModelLoaderTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void shouldLoadOxmModelsWhichMatchToPattern() throws Exception { OxmModelLoader.loadModels("classpath*:test_aai_oxm*.xml", Pattern.compile("test_aai_oxm_(.*).xml")); - Assert.assertTrue(OxmModelLoader.getVersionContextMap().size() == 2); - Assert.assertFalse(OxmModelLoader.getVersionContextMap().containsKey("v7")); - Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v8")); - Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v9")); + Assertions.assertTrue(OxmModelLoader.getVersionContextMap().size() == 2); + Assertions.assertFalse(OxmModelLoader.getVersionContextMap().containsKey("v7")); + Assertions.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v8")); + Assertions.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v9")); } @Test - public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() throws Exception { - thrown.expect(Exception.class); - thrown.expectMessage("Failed to load schema"); + public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() { + Throwable exception = assertThrows(Exception.class, () -> - OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml", - Pattern.compile("non_existing_aai_oxm_(.*).xml")); + OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml", + Pattern.compile("non_existing_aai_oxm_(.*).xml"))); + assertTrue(exception.getMessage().contains("Failed to load schema")); } } |