summaryrefslogtreecommitdiffstats
path: root/aai-schema-ingest
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-08 09:49:07 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-08 10:09:22 +0100
commit315cc50d39facda91c937dbb72d4d28b89524afe (patch)
tree48d71c0bfdf917e8f6b27e743d218389cd680936 /aai-schema-ingest
parent26092e3d55ec4d7be061fbedce43d7b27439af01 (diff)
Upgrade spring boot to 2.6
- upgrade spring boot (2.5.15 -> 2.6.15) - migrate aai-schema-ingest module to JUnit 5 Issue-ID: AAI-4048 Change-Id: I72a59891fdbcdea9b54f6c02aae09fcc7a26947a Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-schema-ingest')
-rw-r--r--aai-schema-ingest/pom.xml33
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java2
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java78
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java89
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java77
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java77
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java17
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java16
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java16
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java29
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java29
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java7
42 files changed, 268 insertions, 389 deletions
diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml
index cf908b19..bc722c1f 100644
--- a/aai-schema-ingest/pom.xml
+++ b/aai-schema-ingest/pom.xml
@@ -127,23 +127,22 @@ limitations under the License.
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- TODO: Migrate tests to junit 5 and remove this dependency -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- </exclusion>
- </exclusions>
- </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>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
index c3222168..e2b5e75f 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
@@ -51,7 +51,6 @@ import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -76,7 +75,6 @@ public class EdgeIngestor {
private Set<Translator> translators;
- @Autowired
public EdgeIngestor(Set<Translator> translatorSet) {
this.translators = translatorSet;
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
index 15b495ad..8db80999 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
@@ -52,7 +52,6 @@ import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -86,7 +85,6 @@ public class NodeIngestor {
* @param translatorSet
*/
- @Autowired
public NodeIngestor(Set<Translator> translatorSet) {
this.translators = translatorSet;
this.caseFormatStore = new CaseFormatStore();
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
index 50b9dc2f..15587c28 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
@@ -33,7 +33,6 @@ import org.apache.commons.io.IOUtils;
import org.onap.aai.edges.JsonIngestor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* Converts the contents of the schema config file
@@ -46,7 +45,6 @@ public abstract class ConfigTranslator extends Translator {
protected SchemaLocationsBean schemaLocationsBean;
- @Autowired
public ConfigTranslator(SchemaLocationsBean schemaLocationsBean, SchemaConfigVersions schemaConfigVersions) {
super(schemaConfigVersions);
this.schemaLocationsBean = schemaLocationsBean;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
index 7308e377..01d8ddd0 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
@@ -29,7 +29,6 @@ import java.util.Map;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -42,7 +41,6 @@ public class DefaultVersionValidationModule implements VersionValidationModule {
private ConfigTranslator config;
- @Autowired
public DefaultVersionValidationModule(ConfigTranslator config) {
this.config = config;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
index a1e95557..bb9d738f 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
@@ -20,7 +20,6 @@
package org.onap.aai.validation;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -34,7 +33,6 @@ public class VersionValidator {
private SchemaErrorStrategy strat;
private VersionValidationModule verMod;
- @Autowired
public VersionValidator(SchemaErrorStrategy strategy, VersionValidationModule verMod) {
this.strat = strategy;
this.verMod = verMod;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
index 620bc726..067d329b 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
@@ -30,7 +30,6 @@ import org.onap.aai.edges.enums.EdgeField;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.validation.SchemaErrorStrategy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -48,7 +47,6 @@ public class EdgeRuleValidator {
protected final CousinDefaultingValidationModule defaultsValidator;
protected final NodeTypesValidationModule typeValidator;
- @Autowired
public EdgeRuleValidator(ConfigTranslator config, SchemaErrorStrategy strat,
EdgeFieldsValidationModule fieldValidator, UniqueLabelValidationModule labelValidator,
SingleContainmentValidationModule containsValidator, CousinDefaultingValidationModule defaultsValidator,
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
index 0de66249..5b574732 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
@@ -26,7 +26,6 @@ import java.util.Set;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -39,7 +38,6 @@ import org.springframework.stereotype.Component;
public class NodeTypesValidationModule {
private NodeIngestor ni;
- @Autowired
public NodeTypesValidationModule(NodeIngestor ni) {
this.ni = ni;
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
index 13de6715..ab951e49 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
@@ -26,7 +26,6 @@ import java.util.Map.Entry;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.validation.SchemaErrorStrategy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -38,7 +37,6 @@ public class NodeValidator {
private SchemaErrorStrategy strat;
private DuplicateNodeDefinitionValidationModule dupChecker;
- @Autowired
public NodeValidator(ConfigTranslator translator, SchemaErrorStrategy strategy,
DuplicateNodeDefinitionValidationModule dupChecker) {
this.translator = translator;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
index 6f896f88..319d62d6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
import java.util.Collection;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.enums.AAIDirection;
import org.onap.aai.edges.enums.MultiplicityRule;
@@ -43,9 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {EdgesConfiguration.class, TestUtilConfigTranslator.class})
@TestPropertySource(
properties = {
@@ -58,9 +53,6 @@ public class EdgeIngestorLocalTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void getRulesTest1() throws EdgeRuleNotFoundException {
EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
@@ -159,11 +151,12 @@ public class EdgeIngestorLocalTest {
}
@Test
- public void getRulesNoneFound() throws EdgeRuleNotFoundException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").build();
- edgeIngestor.getRules(q);
+ public void getRulesNoneFound() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").build();
+ edgeIngestor.getRules(q);
+ });
+ assertTrue(exception.getMessage().contains("No rules found for"));
}
@Test
@@ -218,11 +211,12 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getRuleNoneFoundTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rule found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
- edgeIngestor.getRule(q);
+ public void getRuleNoneFoundTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No rule found for"));
}
// @Test
@@ -234,19 +228,21 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getRuleAmbiguousDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("Multiple defaults found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleAmbiguousDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("Multiple defaults found."));
}
@Test
- public void getRuleNoDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No default found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleNoDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No default found."));
}
// @Test
@@ -360,16 +356,16 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getAllRulesTest() throws EdgeRuleNotFoundException {
- Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
- assertTrue(res.size() == 4);
- assertTrue(res.containsKey("bar|foo"));
- assertTrue(res.get("bar|foo").size() == 2);
- assertTrue(res.containsKey("baz|foo"));
- assertTrue(res.containsKey("foo|quux"));
-
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for version v9.");
- edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ public void getAllRulesTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
+ assertTrue(res.size() == 4);
+ assertTrue(res.containsKey("bar|foo"));
+ assertTrue(res.get("bar|foo").size() == 2);
+ assertTrue(res.containsKey("baz|foo"));
+ assertTrue(res.containsKey("foo|quux"));
+ edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ });
+ assertTrue(exception.getMessage().contains("No rules found for version v9."));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
index 99693c16..932c9e28 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
import java.util.Collection;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.enums.AAIDirection;
import org.onap.aai.edges.enums.MultiplicityRule;
@@ -43,9 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MockProvider.class, EdgesConfiguration.class})
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties",
@@ -56,9 +51,6 @@ public class EdgeIngestorTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void getRulesTest1() throws EdgeRuleNotFoundException {
EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
@@ -161,11 +153,12 @@ public class EdgeIngestorTest {
}
@Test
- public void getRulesNoneFound() throws EdgeRuleNotFoundException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("bogus-value").build();
- edgeIngestor.getRules(q);
+ public void getRulesNoneFound() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("bogus-value").build();
+ edgeIngestor.getRules(q);
+ });
+ assertTrue(exception.getMessage().contains("No rules found for"));
}
@Test
@@ -237,35 +230,39 @@ public class EdgeIngestorTest {
}
@Test
- public void getRuleNoneFoundTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rule found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
- edgeIngestor.getRule(q);
+ public void getRuleNoneFoundTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No rule found for"));
}
@Test
- public void getRuleTooManyPairsTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No way to select single rule from these pairs:");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
- edgeIngestor.getRule(q);
+ public void getRuleTooManyPairsTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No way to select single rule from these pairs:"));
}
@Test
- public void getRuleAmbiguousDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("Multiple defaults found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleAmbiguousDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("Multiple defaults found."));
}
@Test
- public void getRuleNoDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No default found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleNoDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No default found."));
}
@Test
@@ -382,16 +379,16 @@ public class EdgeIngestorTest {
}
@Test
- public void getAllRulesTest() throws EdgeRuleNotFoundException {
- Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
- assertTrue(res.size() == 4);
- assertTrue(res.containsKey("bar|foo"));
- assertTrue(res.get("bar|foo").size() == 2);
- assertTrue(res.containsKey("baz|foo"));
- assertTrue(res.containsKey("foo|quux"));
-
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for version v9.");
- edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ public void getAllRulesTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
+ assertTrue(res.size() == 4);
+ assertTrue(res.containsKey("bar|foo"));
+ assertTrue(res.get("bar|foo").size() == 2);
+ assertTrue(res.containsKey("baz|foo"));
+ assertTrue(res.containsKey("foo|quux"));
+ edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ });
+ assertTrue(exception.getMessage().contains("No rules found for version v9."));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
index 543ce273..fa7f04cd 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
@@ -20,12 +20,10 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.setup.SchemaVersion;
@@ -34,9 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {EdgesConfiguration.class, ConfigTranslatorForWiringTest.class})
@TestPropertySource(
properties = {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
index c1894f00..3396b93c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
@@ -29,8 +29,8 @@ import java.io.InputStream;
import java.util.List;
import java.util.Scanner;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.enums.EdgeType;
public class EdgeRuleQueryTest {
@@ -38,7 +38,7 @@ public class EdgeRuleQueryTest {
private String readStart = "$.rules.[?]";
/* **** DATA SETUP **** */
- @Before
+ @BeforeEach
public void setup() {
InputStream is = getClass().getResourceAsStream("/edgeRules/test.json");
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
index 3fdabfd1..798a32f6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
@@ -20,13 +20,13 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.HashMap;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class EdgeRuleTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
index c67be641..66fbcceb 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
@@ -22,14 +22,14 @@ package org.onap.aai.edges;
import static com.jayway.jsonpath.Criteria.where;
import static com.jayway.jsonpath.Filter.filter;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.Filter;
+import org.junit.jupiter.api.Test;
import java.util.*;
-import org.junit.Test;
import org.onap.aai.setup.SchemaVersion;
public class JsonIngestorTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
index 4e3d61dd..b1063107 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
@@ -20,9 +20,9 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TypeAlphabetizerTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
index f26e603a..90d614b6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
@@ -22,7 +22,8 @@ package org.onap.aai.nodes;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -43,10 +44,7 @@ import javax.xml.transform.stream.StreamResult;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.TestUtilConfigTranslator;
@@ -55,10 +53,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
import org.w3c.dom.Document;
-@RunWith(SpringRunner.class)
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local-node.properties"})
@@ -68,11 +64,6 @@ import org.w3c.dom.Document;
@SpringBootTest
public class NodeIngestorLocalTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
NodeIngestor nodeIngestor;
@@ -90,37 +81,37 @@ public class NodeIngestorLocalTest {
@Test
public void testGetContextForVersion11() {
- DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
-
- // should work bc Foo is valid in test_network_v10 schema
- DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
-
- foo10.set("fooId", "bar");
- assertEquals("bar", foo10.get("fooId"));
-
- // should work bc Bar is valid in test_business_v10 schema
- DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
- bar10.set("barId", "bar2");
- assertEquals("bar2", bar10.get("barId"));
- XSDOutputResolver outputResolver10 = new XSDOutputResolver();
- ctx10.generateSchema(outputResolver10);
-
- DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
-
- // should work bc Foo.quantity is valid in test_network_v11 schema
- DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
- foo11.set("quantity", "12");
- assertEquals("12", foo11.get("quantity"));
-
- DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
- quux11.set("qManagerName", "some guy");
- assertEquals("some guy", quux11.get("qManagerName"));
- XSDOutputResolver outputResolver11 = new XSDOutputResolver();
- ctx11.generateSchema(outputResolver11);
-
- thrown.expect(IllegalArgumentException.class);
- // should fail bc Quux not in v10 test schema
- ctx10.newDynamicEntity("Quux");
+ assertThrows(IllegalArgumentException.class, () -> {
+ DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
+
+ // should work bc Foo is valid in test_network_v10 schema
+ DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
+
+ foo10.set("fooId", "bar");
+ assertEquals("bar", foo10.get("fooId"));
+
+ // should work bc Bar is valid in test_business_v10 schema
+ DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
+ bar10.set("barId", "bar2");
+ assertEquals("bar2", bar10.get("barId"));
+ XSDOutputResolver outputResolver10 = new XSDOutputResolver();
+ ctx10.generateSchema(outputResolver10);
+
+ DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
+
+ // should work bc Foo.quantity is valid in test_network_v11 schema
+ DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
+ foo11.set("quantity", "12");
+ assertEquals("12", foo11.get("quantity"));
+
+ DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
+ quux11.set("qManagerName", "some guy");
+ assertEquals("some guy", quux11.get("qManagerName"));
+ XSDOutputResolver outputResolver11 = new XSDOutputResolver();
+ ctx11.generateSchema(outputResolver11);
+ // should fail bc Quux not in v10 test schema
+ ctx10.newDynamicEntity("Quux");
+ });
}
@Test
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
index 053004bd..6e62505b 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
@@ -22,7 +22,8 @@ package org.onap.aai.nodes;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -43,10 +44,7 @@ import javax.xml.transform.stream.StreamResult;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.restclient.MockProvider;
import org.onap.aai.setup.SchemaVersion;
@@ -55,10 +53,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.w3c.dom.Document;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties",
"spring.main.allow-bean-definition-overriding=true"})
@@ -70,44 +66,39 @@ public class NodeIngestorTest {
@Autowired
NodeIngestor nodeIngestor;
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testGetContextForVersion() {
- DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
-
- // should work bc Foo is valid in test_network_v10 schema
- DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
-
- foo10.set("fooId", "bar");
- assertEquals("bar", foo10.get("fooId"));
-
- // should work bc Bar is valid in test_business_v10 schema
- DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
- bar10.set("barId", "bar2");
- assertEquals("bar2", bar10.get("barId"));
- XSDOutputResolver outputResolver10 = new XSDOutputResolver();
- ctx10.generateSchema(outputResolver10);
-
- DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
-
- // should work bc Foo.quantity is valid in test_network_v11 schema
- DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
- foo11.set("quantity", "12");
- assertEquals("12", foo11.get("quantity"));
-
- DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
- quux11.set("qManagerName", "some guy");
- assertEquals("some guy", quux11.get("qManagerName"));
- XSDOutputResolver outputResolver11 = new XSDOutputResolver();
- ctx11.generateSchema(outputResolver11);
-
- thrown.expect(IllegalArgumentException.class);
- // should fail bc Quux not in v10 test schema
- ctx10.newDynamicEntity("Quux");
+ assertThrows(IllegalArgumentException.class, () -> {
+ DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
+
+ // should work bc Foo is valid in test_network_v10 schema
+ DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
+
+ foo10.set("fooId", "bar");
+ assertEquals("bar", foo10.get("fooId"));
+
+ // should work bc Bar is valid in test_business_v10 schema
+ DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
+ bar10.set("barId", "bar2");
+ assertEquals("bar2", bar10.get("barId"));
+ XSDOutputResolver outputResolver10 = new XSDOutputResolver();
+ ctx10.generateSchema(outputResolver10);
+
+ DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
+
+ // should work bc Foo.quantity is valid in test_network_v11 schema
+ DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
+ foo11.set("quantity", "12");
+ assertEquals("12", foo11.get("quantity"));
+
+ DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
+ quux11.set("qManagerName", "some guy");
+ assertEquals("some guy", quux11.get("qManagerName"));
+ XSDOutputResolver outputResolver11 = new XSDOutputResolver();
+ ctx11.generateSchema(outputResolver11);
+ // should fail bc Quux not in v10 test schema
+ ctx10.newDynamicEntity("Quux");
+ });
}
@Test
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
index 7ae0a2cd..07631ce2 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
@@ -20,12 +20,11 @@
package org.onap.aai.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
@@ -33,9 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ConfigTranslatorForWiringTest.class, NodesConfiguration.class})
@TestPropertySource(
properties = {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
index d2921c73..5ef0ebeb 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
@@ -21,7 +21,7 @@
package org.onap.aai.restclient;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
@@ -124,7 +124,7 @@ public class MockRestClient extends RestClient {
String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
String message = String.format("Unable to find the %s in src/test/resources", filename);
- assertNotNull(message, inputStream);
+ assertNotNull(inputStream, message);
JsonObject payload = JsonParser.parseString(result).getAsJsonObject();
return payload;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
index 4b12936e..743fe70d 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
@@ -23,19 +23,16 @@ package org.onap.aai.restclient;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@Ignore
-@RunWith(SpringJUnit4ClassRunner.class)
+@Disabled
@TestPropertySource(locations = "/schemaService/schema-service-rest.properties")
@ContextConfiguration(
classes = {RestClientFactoryConfiguration.class, SchemaServiceRestClient.class, RestClientFactory.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
index 8136ac0b..d34ea712 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
@@ -20,22 +20,19 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, ConfigTranslatorForWiringTest.class})
@TestPropertySource(
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
index 4d7bf692..e4bd1fe2 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class})
+@SpringJUnitConfig(classes = {SchemaLocationsBean.class})
public class SchemaLocationsBeanDefaultInjectionTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
index bfaa917e..f4cfef2a 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
@@ -20,18 +20,15 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class})
+@SpringJUnitConfig(classes = {SchemaLocationsBean.class})
@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest2.properties"})
public class SchemaLocationsBeanEnvVarInjectionTest {
@Autowired
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
index 78df3891..82e7d491 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:forWiringTests/testContext.xml"})
+@SpringJUnitConfig(locations = {"classpath:forWiringTests/testContext.xml"})
public class SchemaLocationsBeanXMLSetterTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
index 2a5068f2..2d4c0812 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
@@ -20,19 +20,16 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@Ignore("Support of schema ingest via context configuration with prop file is removed as it won't work with spring boot 2")
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:forWiringTests/testUsingPropFileContext.xml"})
+@Disabled("Support of schema ingest via context configuration with prop file is removed as it won't work with spring boot 2")
+@SpringJUnitConfig(locations = {"classpath:forWiringTests/testUsingPropFileContext.xml"})
public class SchemaLocationsBeanXMLSetterWithPropFileTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
index ecc188f7..336dd583 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
@@ -20,35 +20,25 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.restclient.MockProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties"})
@ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class, SchemaConfigVersions.class})
@SpringBootTest
public class SchemaVersionsBeanOverrideTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
SchemaVersionsBean SchemaVersionsBean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
index 981be806..322a6b37 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
@@ -20,34 +20,24 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.restclient.MockProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties"})
@ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class})
@SpringBootTest
public class SchemaVersionsBeanTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
SchemaVersionsBean SchemaVersionsBean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
index fa6d8edc..0022e151 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
@@ -20,9 +20,9 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CheckEverythingStrategyTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
index 0dc68c48..043e9c71 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
@@ -1,4 +1,4 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
@@ -20,29 +20,26 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
public class FailFastStrategyTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Test
public void test() {
- FailFastStrategy strat = new FailFastStrategy();
+ String testError = "hi i'm a problem";
+ Throwable exception = assertThrows(AAISchemaValidationException.class, () -> {
+ FailFastStrategy strat = new FailFastStrategy();
- // simulate no issues found
- assertTrue(strat.isOK());
- assertTrue("No errors found.".equals(strat.getErrorMsg()));
+ // simulate no issues found
+ assertTrue(strat.isOK());
+ assertTrue("No errors found.".equals(strat.getErrorMsg()));
- // simulate an issue found
- String testError = "hi i'm a problem";
- thrown.expect(AAISchemaValidationException.class);
- thrown.expectMessage(testError);
- strat.notifyOnError(testError);
+ // simulate an issue found
+ strat.notifyOnError(testError);
+ });
+ assertTrue(exception.getMessage().contains(testError));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
index 4c6882c8..bcf79d2d 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, BadNodeConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultVersionValidationModule.class, VersionValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
index a74f7ba9..f2bb85a3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
@@ -20,19 +20,16 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultVersionValidationModule.class, VersionValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
index 58940af5..466e4b90 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
@@ -29,8 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -38,7 +38,7 @@ public class CousinDefaultingValidationModuleTest {
private static List<DocumentContext> ctxs;
private static CousinDefaultingValidationModule validator;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
Map<SchemaVersion, List<String>> testRules = new HashMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
index a4c70b81..08298f2f 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
@@ -20,20 +20,17 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.enums.EdgeField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {DefaultEdgeFieldsValidationModule.class})
@SpringBootTest
public class DefaultEdgeFieldsValidationModuleTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
index b1bf3146..60c04aab 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.BadEdgeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, BadEdgeConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
index 60943219..53cad53c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
index e80e2fea..191a10d0 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
@@ -20,13 +20,12 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.TestUtilConfigTranslator;
@@ -34,9 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, TestUtilConfigTranslator.class, NodeTypesValidationModule.class})
@TestPropertySource(
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
index a704d80b..d34772e3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
@@ -20,14 +20,14 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import java.util.*;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -36,7 +36,7 @@ public class SingleContainmentValidationModuleTest {
private static SingleContainmentValidationModule validator;
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
index 76e52036..22553b9e 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
@@ -20,14 +20,14 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import java.util.*;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -36,7 +36,7 @@ public class UniqueLabelValidationModuleTest {
private static UniqueLabelValidationModule validator;
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- @BeforeClass
+ @BeforeAll
public static void setup() {
Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
index 93cb2ab3..69956297 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -32,9 +31,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {BadNodeConfigForValidationTest.class, NodesConfiguration.class, CheckEverythingStrategy.class,
DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
index c2e7b7ba..aa8aabc3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
@@ -20,6 +20,8 @@
package org.onap.aai.validation.nodes;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -32,11 +34,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -45,34 +44,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.w3c.dom.Document;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {SchemaIncompleteTranslator.class, NodesConfiguration.class})
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local.properties"})
@SpringBootTest
-@Ignore
+@Disabled
public class NodeValidatorSchemaIncompleteTest {
@Autowired
NodeIngestor ni;
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
// Throws a NullPointerException because a JavaType is referenced, but not defined
@Test
- public void testIncompleteCombinedSchema() throws TransformerException, IOException, IllegalStateException {
- thrown.expect(NullPointerException.class);
+ public void testIncompleteCombinedSchema() {
+ assertThrows(NullPointerException.class, () -> {
- // TODO Change for Exception
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- printDocument(ni.getSchema(new SchemaVersion("v12")), buffer);
+ // TODO Change for Exception
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ printDocument(ni.getSchema(new SchemaVersion("v12")), buffer);
+ });
}
public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
index 893dd04c..d8a69333 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})