aboutsummaryrefslogtreecommitdiffstats
path: root/aai-schema-gen
diff options
context:
space:
mode:
Diffstat (limited to 'aai-schema-gen')
-rw-r--r--aai-schema-gen/pom.xml40
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java46
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java29
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java29
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java19
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java8
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java21
19 files changed, 222 insertions, 235 deletions
diff --git a/aai-schema-gen/pom.xml b/aai-schema-gen/pom.xml
index ceb0a86..b7723e7 100644
--- a/aai-schema-gen/pom.xml
+++ b/aai-schema-gen/pom.xml
@@ -646,12 +646,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.3</version>
@@ -683,6 +677,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -720,9 +718,35 @@
<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.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
+ <artifactId>mockito-core</artifactId>
+ <version>4.11.0</version>
+ <scope>test</scope>
+ </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>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
index 9b28e3b..c9b8a64 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
@@ -21,16 +21,15 @@
package org.onap.aai.schemagen;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.BufferedWriter;
import java.io.FileWriter;
-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.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.genxsd.HTMLfromOXM;
@@ -46,12 +45,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-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(
+@SpringJUnitConfig(
classes = {SchemaLocationsBean.class, TestUtilConfigTranslatorforBusiness.class,
EdgeIngestor.class, NodeIngestor.class, SwaggerGenerationConfiguration.class,
SchemaConfigVersions.class})
@@ -73,7 +70,7 @@ public class GenerateXsdTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
x.setUp();
@@ -88,7 +85,7 @@ public class GenerateXsdTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
// PowerMockito.mockStatic(GenerateXsd.class);
XSDElementTest x = new XSDElementTest();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
index 4729af4..cc8b642 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
@@ -22,24 +22,21 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DeleteFootnoteSetTest {
String targetNode;
String flavor;
String result;
DeleteFootnoteSet footnotes = null;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {
{"vserver", "(1)",
@@ -57,33 +54,40 @@ public class DeleteFootnoteSetTest {
return (Arrays.asList(inputs));
}
- public DeleteFootnoteSetTest(String targetNode, String flavor, String result) {
- super();
+ public void initDeleteFootnoteSetTest(String targetNode, String flavor, String result) {
this.targetNode = targetNode;
this.flavor = flavor;
this.result = result;
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
footnotes = new DeleteFootnoteSet(this.targetNode);
}
- @Test
- public void testDeleteFootnoteSet() {
- assertThat(footnotes.targetNode, is(this.targetNode));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDeleteFootnoteSet(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ assertEquals(targetNode, footnoteSet.targetNode);
+ // initDeleteFootnoteSetTest(targetNode, flavor, result);
+ // assertThat(footnotes.targetNode, is(this.targetNode));
}
- @Test
- public void testAdd() {
- footnotes.add(this.flavor);
- assertThat(footnotes.footnotes.size(), is(1));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAdd(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ footnoteSet.add(flavor);
+ assertEquals(1, footnoteSet.footnotes.size());
}
- @Test
- public void testToString() {
- footnotes.add(this.flavor);
- assertThat(footnotes.toString(), is(this.result));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ footnoteSet.add(flavor);
+ assertEquals(result, footnoteSet.toString());
}
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
index 08f5c81..dd9675f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
@@ -21,18 +21,15 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DeleteOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -41,7 +38,6 @@ public class DeleteOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -65,9 +61,8 @@ public class DeleteOperationTest {
return Arrays.asList(inputs);
}
- public DeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initDeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -76,13 +71,15 @@ public class DeleteOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initDeleteOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
DeleteOperation delete =
new DeleteOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = delete.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
index 046f961..da2e271 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
@@ -21,8 +21,8 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Multimap;
@@ -35,11 +35,10 @@ import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
@@ -49,12 +48,10 @@ import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
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(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class})
@TestPropertySource(
@@ -72,7 +69,7 @@ public class EdgeDescriptionTest {
String toNode = "complex";
SchemaVersion v10 = new SchemaVersion("v10");
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String json = "{" + " \"rules\": [" + " {" + " \"from\": \"availability-zone\","
+ " \"to\": \"complex\","
@@ -133,13 +130,13 @@ public class EdgeDescriptionTest {
bw.close();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
index aad62ce..5044166 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
@@ -21,21 +21,18 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Vector;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class GetOperationTest {
private static final Logger logger = LoggerFactory.getLogger("GetOperationTest.class");
private String useOpId;
@@ -45,7 +42,6 @@ public class GetOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class GetOperationTest {
return Arrays.asList(inputs);
}
- public GetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,7 +73,7 @@ public class GetOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
@@ -91,8 +86,10 @@ public class GetOperationTest {
GetOperation.addContainerProps(container, containerProps);
}
- @Test
- public void testAddContainerProps() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAddContainerProps(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
String container = this.xmlRootElementName;
String prop = " - name: " + container
+ "\n in: query\n description:\n required: false\n type: string";
@@ -106,8 +103,10 @@ public class GetOperationTest {
assertThat(GetOperation.containers.get(container).get(0), is(prop));
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
GetOperation get = new GetOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = get.toString();
assertThat(modResult, is(this.result));
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
index 46f90ce..4baf8f0 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
@@ -21,7 +21,7 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.BufferedWriter;
import java.io.File;
@@ -32,10 +32,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-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.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.SwaggerGenerationConfiguration;
@@ -47,13 +46,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-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;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -73,19 +70,19 @@ public class HTMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpContext() throws Exception {
}
- @BeforeClass
+ @BeforeAll
public static void setupBundleconfig() throws Exception {
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
System.setProperty("aai.service.name", SERVICE_NAME);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
setUp(0);
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
index fc75150..c690ca8 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
@@ -21,21 +21,18 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Vector;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class NodeGetOperationTest {
private static final Logger logger = LoggerFactory.getLogger("NodeGetOperationTest.class");
private String useOpId;
@@ -45,7 +42,6 @@ public class NodeGetOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class NodeGetOperationTest {
return Arrays.asList(inputs);
}
- public NodeGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initNodeGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,7 +73,7 @@ public class NodeGetOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
@@ -91,8 +86,10 @@ public class NodeGetOperationTest {
NodeGetOperation.addContainerProps(container, containerProps);
}
- @Test
- public void testAddContainerProps() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAddContainerProps(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initNodeGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
String container = this.xmlRootElementName;
String prop = " - name: " + container
+ "\n in: query\n description:\n required: false\n type: string";
@@ -109,8 +106,10 @@ public class NodeGetOperationTest {
NodeGetOperation.containers.get(container).get(0), is(prop));
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initNodeGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
NodeGetOperation get =
new NodeGetOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = get.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
index d87bdf7..87e967e 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
@@ -21,7 +21,7 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.BufferedWriter;
import java.io.File;
@@ -32,10 +32,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-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.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.SwaggerGenerationConfiguration;
@@ -47,13 +46,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-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;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -74,7 +71,7 @@ public class NodesYAMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
@@ -90,7 +87,7 @@ public class NodesYAMLfromOXMTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
NodeGetOperation.checklist.clear();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
index d939a74..3735636 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
@@ -21,19 +21,16 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.onap.aai.setup.SchemaVersion;
-@RunWith(Parameterized.class)
public class PatchOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -43,7 +40,6 @@ public class PatchOperationTest {
private String result;
private static SchemaVersion v = new SchemaVersion("v16");
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class PatchOperationTest {
return Arrays.asList(inputs);
}
- public PatchOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initPatchOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,13 +73,15 @@ public class PatchOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initPatchOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
PatchOperation patch =
new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai");
String modResult = patch.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
index c5b9408..c2ab69c 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
@@ -21,19 +21,16 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.onap.aai.setup.SchemaVersion;
-@RunWith(Parameterized.class)
public class PutOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -43,7 +40,6 @@ public class PutOperationTest {
private String result;
private static SchemaVersion v = new SchemaVersion("v14");
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -69,9 +65,8 @@ public class PutOperationTest {
return Arrays.asList(inputs);
}
- public PutOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initPutOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -80,13 +75,15 @@ public class PutOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initPutOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
PutOperation put =
new PutOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai");
String modResult = put.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
index b955f96..637039f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
@@ -22,30 +22,27 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.schemagen.GenerateXsd;
import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaVersion;
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 = {SchemaConfigVersions.class, EdgeIngestor.class})
+@SpringJUnitConfig(classes = {SchemaConfigVersions.class, EdgeIngestor.class})
@TestPropertySource(properties = {"schema.uri.base.path = /aai"})
-@Ignore("This test needs to get major rework done as it is written very poorly")
+@Disabled("This test needs to get major rework done as it is written very poorly")
public class PutRelationPathSetTest {
private static final String EDGEFILENAME =
"src/test/resources/dbedgerules/EdgeDescriptionRules_test.json";
@@ -66,7 +63,7 @@ public class PutRelationPathSetTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Before
+ @BeforeEach
public void setUpBeforeClass() throws Exception {
v = schemaConfigVersions.getDefaultVersion();
@@ -139,7 +136,7 @@ public class PutRelationPathSetTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
DeleteOperation.deletePaths.put("/cloud-infrastructure/pservers/pserver/{hostname}",
@@ -167,7 +164,7 @@ public class PutRelationPathSetTest {
PutRelationPathSet.add(opId, path);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
index 1442ba9..f2ce481 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
@@ -23,11 +23,11 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.both;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.core.Every.everyItem;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.io.StringReader;
@@ -42,10 +42,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -65,11 +65,11 @@ public class XSDElementTest {
return testXML;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
setUp(0);
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
index e750da2..2938b57 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
@@ -21,17 +21,17 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.HashMap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
public class XSDJavaTypeTest extends XSDElementTest {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
index f04b351..7fff5fa 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
@@ -21,9 +21,9 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Multimap;
@@ -38,10 +38,9 @@ import java.nio.file.Paths;
import java.util.SortedSet;
import java.util.TreeSet;
-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.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
@@ -55,14 +54,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-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;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -90,14 +87,14 @@ public class YAMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
System.setProperty("aai.service.name", SERVICE_NAME);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
XSDElementTest x = new XSDElementTest();
x.setUp();
@@ -230,7 +227,7 @@ public class YAMLfromOXMTest {
e.printStackTrace();
}
boolean matchFound = fileContent.contains((YAMLRelationshipList()));
- assertTrue("RelationshipListFormat:\n", matchFound);
+ assertTrue(matchFound, "RelationshipListFormat:\n");
}
@Test
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
index 2a39149..b0526e5 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
@@ -26,13 +26,10 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class ApiHttpVerbResponseTest {
Api.HttpVerb.Response theResponse = null;
String responseCode;
@@ -42,7 +39,6 @@ public class ApiHttpVerbResponseTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"200", "OK", "Response{responseCode='200', description='OK'}"},
{"400", "Bad Request", "Response{responseCode='400', description='Bad Request'}"},
@@ -56,8 +52,7 @@ public class ApiHttpVerbResponseTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public ApiHttpVerbResponseTest(String responseCode, String description, String result) {
- super();
+ public void initApiHttpVerbResponseTest(String responseCode, String description, String result) {
this.responseCode = responseCode;
this.description = description;
this.result = result;
@@ -66,7 +61,7 @@ public class ApiHttpVerbResponseTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theResponse = new Api.HttpVerb.Response();
}
@@ -74,8 +69,10 @@ public class ApiHttpVerbResponseTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testApiHttpVerbResponse() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testApiHttpVerbResponse(String responseCode, String description, String result) {
+ initApiHttpVerbResponseTest(responseCode, description, result);
theResponse.setResponseCode(this.responseCode);
theResponse.setDescription(this.description);
assertThat(theResponse.toString(), is(this.result));
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
index c714d82..3f3e804 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
@@ -30,13 +30,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class ApiHttpVerbTest {
Api.HttpVerb theVerb = null;
List<String> tags;
@@ -50,7 +47,6 @@ public class ApiHttpVerbTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"tag1,tag2", "typeA", "summaryB", "operationC", "consumesD,consumesE",
"producesF,producesG",
@@ -64,9 +60,8 @@ public class ApiHttpVerbTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public ApiHttpVerbTest(String tags, String type, String summary, String operationId,
+ public void initApiHttpVerbTest(String tags, String type, String summary, String operationId,
String consumes, String produces, String result) {
- super();
this.tags = Arrays.asList(tags.split(","));
this.type = type;
this.summary = summary;
@@ -80,7 +75,7 @@ public class ApiHttpVerbTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theVerb = new Api.HttpVerb();
}
@@ -88,8 +83,10 @@ public class ApiHttpVerbTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testApiHttpVerb() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testApiHttpVerb(String tags, String type, String summary, String operationId, String consumes, String produces, String result) {
+ initApiHttpVerbTest(tags, type, summary, operationId, consumes, produces, result);
theVerb.setTags(this.tags);
theVerb.setType(this.type);
theVerb.setSummary(this.summary);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
index fef3344..8b2e46f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
@@ -26,13 +26,10 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DefinitionPropertyTest {
Definition.Property theProperty = null;
String propertyName;
@@ -43,7 +40,6 @@ public class DefinitionPropertyTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {
{"name1", "type1", "ref1",
@@ -58,9 +54,8 @@ public class DefinitionPropertyTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public DefinitionPropertyTest(String propertyName, String propertyType,
+ public void initDefinitionPropertyTest(String propertyName, String propertyType,
String propertyReference, String result) {
- super();
this.propertyName = propertyName;
this.propertyType = propertyType;
this.propertyReference = propertyReference;
@@ -70,7 +65,7 @@ public class DefinitionPropertyTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theProperty = new Definition.Property();
}
@@ -78,8 +73,10 @@ public class DefinitionPropertyTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testDefinitionProperty() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDefinitionProperty(String propertyName, String propertyType, String propertyReference, String result) {
+ initDefinitionPropertyTest(propertyName, propertyType, propertyReference, result);
theProperty.setPropertyName(this.propertyName);
theProperty.setPropertyType(this.propertyType);
theProperty.setPropertyReference(this.propertyReference);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
index 98169d8..fe3f8cd 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
@@ -28,13 +28,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DefinitionTest {
Definition theDefinition = null;
String definitionName;
@@ -44,7 +41,6 @@ public class DefinitionTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"name1", "desc1",
"Definition{definitionName='name1', definitionDescription='desc1', propertyList=[]}"},
@@ -58,8 +54,7 @@ public class DefinitionTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public DefinitionTest(String definitionName, String definitionDescription, String result) {
- super();
+ public void initDefinitionTest(String definitionName, String definitionDescription, String result) {
this.definitionName = definitionName;
this.definitionDescription = definitionDescription;
this.result = result;
@@ -68,7 +63,7 @@ public class DefinitionTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theDefinition = new Definition();
}
@@ -76,8 +71,10 @@ public class DefinitionTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testDefinitionProperty() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDefinitionProperty(String definitionName, String definitionDescription, String result) {
+ initDefinitionTest(definitionName, definitionDescription, result);
theDefinition.setDefinitionName(this.definitionName);
theDefinition.setDefinitionDescription(this.definitionDescription);