aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdheli Tavares <adheli.tavares@est.tech>2024-06-26 08:22:11 +0000
committerGerrit Code Review <gerrit@onap.org>2024-06-26 08:22:11 +0000
commit02e14c79d535773f2bb9e020f285208265e3f994 (patch)
tree1a3ba6ab216aec2770537e066a43893db3b04e8a
parent7b11ab5c03a438aa29ff2242fa06bb8ff28c2867 (diff)
parent09f9bc016598cb287c681418203852b0b619e931 (diff)
Merge "Convert models to JUnit 5"
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java16
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java16
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java13
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java15
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java10
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java8
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java32
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java25
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java15
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java20
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java8
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java12
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java32
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java28
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java20
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java9
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java132
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java9
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java10
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java10
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java22
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java9
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java12
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java28
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java33
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java28
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java26
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java7
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java62
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java8
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java12
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java8
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java44
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java3
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java22
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java36
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java24
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java20
38 files changed, 419 insertions, 425 deletions
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
index 2ab315ddd..6036ad99f 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,12 +19,12 @@
package org.onap.policy.models.pap.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.TextFileUtils;
@@ -34,10 +34,10 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierO
/**
* This only tests the methods that aren't already tested via TestModels.
*/
-public class PapPolicyIdentifierTest {
+class PapPolicyIdentifierTest {
@Test
- public void testPapPolicyIdentifier() throws CoderException {
+ void testPapPolicyIdentifier() {
assertNotNull(new PapPolicyIdentifier("Name", "Version"));
assertNotNull(new PapPolicyIdentifier("Name", null));
assertNotNull(new PapPolicyIdentifier(null, null));
@@ -62,7 +62,7 @@ public class PapPolicyIdentifierTest {
}
@Test
- public void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
+ void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
String idString = TextFileUtils.getTextFileAsString("src/test/resources/json/PapPolicyIdentifier.json");
StandardCoder coder = new StandardCoder();
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
index 3664cc39c..0ba0bfd23 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,14 @@
package org.onap.policy.models.pap.concepts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.TextFileUtils;
@@ -34,9 +34,9 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierO
/**
* This only tests the methods that aren't already tested via TestModels.
*/
-public class PdpDeployPoliciesTest {
+class PdpDeployPoliciesTest {
@Test
- public void testPapPolicyIdentifier() throws CoderException, IOException {
+ void testPapPolicyIdentifier() {
assertNotNull(new PdpDeployPolicies());
List<ToscaConceptIdentifierOptVersion> tciListIn = new ArrayList<>();
@@ -68,7 +68,7 @@ public class PdpDeployPoliciesTest {
}
@Test
- public void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
+ void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
String idListString = TextFileUtils.getTextFileAsString("src/test/resources/json/PapPoliciesList.json");
StandardCoder coder = new StandardCoder();
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java
index d3b8cc497..315ee9bd1 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,22 +19,22 @@
package org.onap.policy.models.pap.concepts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test class for PdpGroupDeployResponse.
*/
-public class PdpGroupDeployResponseTest {
+class PdpGroupDeployResponseTest {
private static final String URI = "/policy/pap/v1/policies/status";
private static final String MESSAGE = "the message";
@Test
- public void testPdpGroupDeployResponse() {
+ void testPdpGroupDeployResponse() {
assertNotNull(new PdpGroupDeployResponse("message", "uri"));
assertNotNull(new PdpGroupDeployResponse("message", null));
assertNotNull(new PdpGroupDeployResponse(null, null));
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java
index 10c7c5fee..c6b88abc1 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,25 +19,25 @@
package org.onap.policy.models.pap.concepts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
/**
* This only tests the methods that aren't already tested via TestModels.
*/
-public class PolicyNotificationTest {
+class PolicyNotificationTest {
@Test
- public void test() throws CoderException {
+ void test() throws CoderException {
PolicyStatus statusAdd1 = new PolicyStatus();
statusAdd1.setSuccessCount(10);
PolicyStatus statusAdd2 = new PolicyStatus();
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
index 997c30414..0f1c4b9cf 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
package org.onap.policy.models.pap.concepts;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -29,10 +29,10 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* This only tests the methods that aren't already tested via TestModels.
*/
-public class PolicyStatusTest {
+class PolicyStatusTest {
@Test
- public void test() throws CoderException {
+ void test() throws CoderException {
ToscaConceptIdentifier type = new ToscaConceptIdentifier("my-type", "3.2.1");
ToscaConceptIdentifier policy = new ToscaConceptIdentifier("my-name", "1.2.3");
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
index 1658ccbd0..07b9d17b8 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ToStringTester;
/**
@@ -35,10 +35,10 @@ import org.onap.policy.common.utils.test.ToStringTester;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-public class TestModels {
+class TestModels {
@Test
- public void testPapModels() {
+ void testPapModels() {
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(TestModels.class.getPackage().getName());
// @formatter:off
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java
index 25d7304ee..25b3219c6 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,15 @@ package org.onap.policy.models.pap.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.models.pap.concepts.PolicyAudit;
import org.onap.policy.models.pap.concepts.PolicyAudit.AuditAction;
@@ -39,7 +39,7 @@ import org.onap.policy.models.pdp.concepts.PdpPolicyStatus.State;
import org.onap.policy.models.pdp.persistence.concepts.JpaPdpPolicyStatus;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-public class JpaPolicyAuditTest {
+class JpaPolicyAuditTest {
private static final ToscaConceptIdentifier MY_POLICY = new ToscaConceptIdentifier("MyPolicy", "1.2.3");
private static final String PDP_GROUP = "pdpGroupxyz";
@@ -50,14 +50,14 @@ public class JpaPolicyAuditTest {
/**
* Setup an audit for usage on unit tests.
*/
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
audit = PolicyAudit.builder().auditId(1L).pdpGroup(PDP_GROUP).pdpType("pdpType").policy(MY_POLICY)
.action(AuditAction.DEPLOYMENT).timestamp(Instant.now().truncatedTo(ChronoUnit.SECONDS)).build();
}
@Test
- public void testCompareTo() {
+ void testCompareTo() {
JpaPolicyAudit jpaAudit = new JpaPolicyAudit(audit);
assertEquals(-1, jpaAudit.compareTo(null));
assertEquals(0, jpaAudit.compareTo(jpaAudit));
@@ -70,7 +70,7 @@ public class JpaPolicyAuditTest {
}
@Test
- public void testKeys() {
+ void testKeys() {
JpaPolicyAudit jpaAudit = new JpaPolicyAudit();
assertThat(jpaAudit.getKeys()).isNotNull();
assertTrue(jpaAudit.getKey().isNullKey());
@@ -80,7 +80,7 @@ public class JpaPolicyAuditTest {
}
@Test
- public void testClean() {
+ void testClean() {
audit.setUser(" user");
JpaPolicyAudit jpaAudit = new JpaPolicyAudit(audit);
assertThatNoException().isThrownBy(() -> jpaAudit.clean());
@@ -88,7 +88,7 @@ public class JpaPolicyAuditTest {
}
@Test
- public void testToAuthorative() {
+ void testToAuthorative() {
audit.setUser(USER);
JpaPolicyAudit jpaAudit = new JpaPolicyAudit(audit);
PolicyAudit convertedAudit = jpaAudit.toAuthorative();
@@ -103,7 +103,7 @@ public class JpaPolicyAuditTest {
}
@Test
- public void testConversionsWithRequiredOnly() {
+ void testConversionsWithRequiredOnly() {
audit = PolicyAudit.builder().policy(MY_POLICY).action(AuditAction.DEPLOYMENT)
.timestamp(Instant.now().truncatedTo(ChronoUnit.SECONDS)).build();
@@ -115,7 +115,7 @@ public class JpaPolicyAuditTest {
}
@Test
- public void testValidation() {
+ void testValidation() {
PolicyAudit invalidAudit = PolicyAudit.builder().pdpGroup(PDP_GROUP).user(USER).build();
JpaPolicyAudit jpaAudit = new JpaPolicyAudit(invalidAudit);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
index e3438acb9..202ab69d7 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,30 +22,30 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup.Action;
/**
* Test methods not tested by {@link ModelsTest}.
*/
-public class DeploymentGroupTest {
+class DeploymentGroupTest {
private static final String NAME = "my-name";
private static final String PDP_TYPE1 = "type-1";
private static final String PDP_TYPE2 = "type-2";
private static final String PDP_TYPE3 = "type-3";
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new DeploymentGroup(null)).isInstanceOf(NullPointerException.class);
DeploymentGroup orig = new DeploymentGroup();
@@ -66,7 +67,7 @@ public class DeploymentGroupTest {
}
@Test
- public void testHashCode() {
+ void testHashCode() {
DeploymentGroup group = new DeploymentGroup();
group.setName("A");
int hash = group.hashCode();
@@ -78,7 +79,7 @@ public class DeploymentGroupTest {
}
@Test
- public void testValidatePapRest() {
+ void testValidatePapRest() {
DeploymentGroup group = new DeploymentGroup();
group.setName(NAME);
@@ -127,7 +128,7 @@ public class DeploymentGroupTest {
}
@Test
- public void testCheckDuplicateSubgroups() {
+ void testCheckDuplicateSubgroups() {
DeploymentGroup group = new DeploymentGroup();
group.setName(NAME);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java
index 18b13759a..bc3da4870 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,21 +21,21 @@
package org.onap.policy.models.pdp.concepts;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup.Action;
-public class DeploymentGroupsTest {
+class DeploymentGroupsTest {
@Test
- public void testValidatePapRest_toMapList() {
+ void testValidatePapRest_toMapList() {
DeploymentGroup group1 = new DeploymentGroup();
group1.setName("group-1");
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java
index 744c2e892..7b87a5c63 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,14 +22,14 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -40,12 +40,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test methods not tested by {@link ModelsTest}.
*/
-public class DeploymentSubGroupTest {
+class DeploymentSubGroupTest {
private static final String VERSION_300 = "3.0.0";
private static final Coder coder = new StandardCoder();
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new DeploymentSubGroup(null)).isInstanceOf(NullPointerException.class);
final DeploymentSubGroup orig = new DeploymentSubGroup();
@@ -69,7 +69,7 @@ public class DeploymentSubGroupTest {
}
@Test
- public void testValidatePapRest() throws Exception {
+ void testValidatePapRest() throws Exception {
DeploymentSubGroup subgrp = new DeploymentSubGroup();
subgrp.setPdpType("pdp-type");
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
index 95af26588..3a9a715b7 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@ import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ToStringTester;
/**
@@ -35,11 +35,11 @@ import org.onap.policy.common.utils.test.ToStringTester;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-public class ModelsTest {
+class ModelsTest {
private static final String POJO_PACKAGE = "org.onap.policy.models.pdp.concepts";
@Test
- public void testPdpModels() {
+ void testPdpModels() {
final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterTester())
.with(new GetterTester()).build();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java
index b748b915c..c438d9e76 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,16 +21,16 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Instant;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpEngineWorkerState;
-public class PdpEngineWorkerStatisticsTest {
+class PdpEngineWorkerStatisticsTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpEngineWorkerStatistics(null)).hasMessageContaining("source");
PdpEngineWorkerStatistics stat = createPdpEngineWorkerStatistics();
@@ -39,7 +39,7 @@ public class PdpEngineWorkerStatisticsTest {
}
@Test
- public void testClean() {
+ void testClean() {
PdpEngineWorkerStatistics stat = createPdpEngineWorkerStatistics();
stat.setEngineId(" Engine0 ");
stat.clean();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java
index 89a1333ef..5019afa80 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,14 +22,14 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -41,7 +41,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class PdpGroupFilterTest {
+class PdpGroupFilterTest {
private static final String POLICY_TYPE3 = "policy.type.3";
private static final String POLICY_TYPE2 = "policy.type.2";
private static final String POLICY_TYPE1 = "policy.type.1";
@@ -63,15 +63,15 @@ public class PdpGroupFilterTest {
*
* @throws CoderException on JSON decoding errors
*/
- @Before
- public void setupPdpGroupList() throws CoderException {
+ @BeforeEach
+ void setupPdpGroupList() throws CoderException {
String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroupsForFiltering.json");
PdpGroups pdpGroups = new StandardCoder().decode(originalJson, PdpGroups.class);
pdpGroupList = pdpGroups.getGroups();
}
@Test
- public void testNullList() {
+ void testNullList() {
PdpGroupFilter filter = PdpGroupFilter.builder().build();
assertThatThrownBy(() -> {
@@ -80,7 +80,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterNothing() {
+ void testFilterNothing() {
PdpGroupFilter filter = PdpGroupFilter.builder().build();
List<PdpGroup> filteredList = filter.filter(pdpGroupList);
@@ -88,7 +88,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterName() {
+ void testFilterName() {
PdpGroupFilter filter = PdpGroupFilter.builder().name("PdpGroup0").build();
List<PdpGroup> filteredList = filter.filter(pdpGroupList);
assertEquals(1, filteredList.size());
@@ -115,7 +115,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterPdpGroupState() {
+ void testFilterPdpGroupState() {
PdpGroupFilter filter = PdpGroupFilter.builder().groupState(PdpState.ACTIVE).build();
List<PdpGroup> filteredList = filter.filter(pdpGroupList);
assertEquals(1, filteredList.size());
@@ -138,7 +138,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterPdpType() {
+ void testFilterPdpType() {
PdpGroupFilter filter = PdpGroupFilter.builder().pdpType("APEX").build();
List<PdpGroup> filteredList = filter.filter(pdpGroupList);
assertEquals(5, filteredList.size());
@@ -153,7 +153,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterPdpState() {
+ void testFilterPdpState() {
PdpGroupFilter filter = PdpGroupFilter.builder().pdpState(PdpState.ACTIVE).build();
List<PdpGroup> filteredList = filter.filter(pdpGroupList);
assertEquals(3, filteredList.size());
@@ -172,7 +172,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterPolicyType() {
+ void testFilterPolicyType() {
List<ToscaConceptIdentifier> identifierList = new ArrayList<>();
identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1));
@@ -288,7 +288,7 @@ public class PdpGroupFilterTest {
}
@Test
- public void testFilterPolicy() {
+ void testFilterPolicy() {
List<ToscaConceptIdentifier> identifierList = new ArrayList<>();
identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
index ae88f50f9..f5cdecfea 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,12 +22,12 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -35,7 +35,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -43,7 +43,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test methods not tested by {@link ModelsTest}.
*/
-public class PdpGroupTest {
+class PdpGroupTest {
private static final String VERSION = "1.2.3";
private static final String NAME = "my-name";
private static final String PDP_TYPE1 = "type-1";
@@ -51,7 +51,7 @@ public class PdpGroupTest {
private static final String PDP_TYPE3 = "type-3";
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpGroup(null)).isInstanceOf(NullPointerException.class);
PdpGroup orig = new PdpGroup();
@@ -87,7 +87,7 @@ public class PdpGroupTest {
}
@Test
- public void testHashCode() {
+ void testHashCode() {
PdpGroup group = new PdpGroup();
group.setDescription("A");
int hash = group.hashCode();
@@ -99,7 +99,7 @@ public class PdpGroupTest {
}
@Test
- public void testCompareTo() {
+ void testCompareTo() {
PdpGroup pdpGroup0 = new PdpGroup();
pdpGroup0.setName("Name0");
pdpGroup0.setVersion(VERSION);
@@ -122,7 +122,7 @@ public class PdpGroupTest {
}
@Test
- public void testValidatePapRest_GroupUpdateFlow() {
+ void testValidatePapRest_GroupUpdateFlow() {
PdpGroup group = new PdpGroup();
group.setName(NAME);
// with supported policy type and policies
@@ -158,7 +158,7 @@ public class PdpGroupTest {
}
@Test
- public void testValidatePapRest() {
+ void testValidatePapRest() {
PdpGroup group = new PdpGroup();
group.setName(NAME);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
index 5cf7c1340..09d94d09f 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,26 +21,26 @@
package org.onap.policy.models.pdp.concepts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-public class PdpGroupsTest {
+class PdpGroupsTest {
@Test
- public void testValidatePapRest_toMapList() {
+ void testValidatePapRest_toMapList() {
PdpGroup group1 = new PdpGroup();
group1.setName("group-1");
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java
index e1c76671a..5caa4e5d4 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Copyright
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,19 +22,19 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpState;
/**
* Test the copy constructor, as {@link ModelsTest} tests the other methods.
*/
-public class PdpInstanceDetailsTest {
+class PdpInstanceDetailsTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new Pdp(null)).isInstanceOf(NullPointerException.class);
Pdp orig = new Pdp();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java
index 763b29a4b..50b211d58 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,16 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpMessageType;
-public class PdpMessageTest {
+class PdpMessageTest {
private static final String PDP_GROUP_MSG = " pdp group ";
private static final String PDP_NAME = "pdpA";
private static final String PDP_GROUP = "groupA";
@@ -39,47 +40,47 @@ public class PdpMessageTest {
private PdpMessage message;
+ @BeforeEach
+ void setUp() {
+ message = new PdpMessage(PdpMessageType.PDP_STATE_CHANGE);
+ }
+
@Test
- public void testCopyConstructorAndEquals() {
+ void testCopyConstructorAndEquals() {
assertThatThrownBy(() -> new PdpMessage((PdpMessage) null)).isInstanceOf(NullPointerException.class);
- // verify with null values
- message = new PdpMessage(PdpMessageType.PDP_STATE_CHANGE);
- PdpMessage newmsg = new PdpMessage(message);
- newmsg.setRequestId(message.getRequestId());
- newmsg.setTimestampMs(message.getTimestampMs());
- assertEquals(message.toString(), newmsg.toString());
- assertEquals(message, newmsg);
+ // Verify with null values
+ PdpMessage newMsg = new PdpMessage(message);
+ newMsg.setRequestId(message.getRequestId());
+ newMsg.setTimestampMs(message.getTimestampMs());
+ assertEquals(message.toString(), newMsg.toString());
+ assertEquals(message, newMsg);
- // verify with all values
+ // Verify with all values
message = makeMessage(PDP_NAME, PDP_GROUP, PDP_SUBGROUP);
- newmsg = new PdpMessage(message);
- newmsg.setRequestId(message.getRequestId());
- newmsg.setTimestampMs(message.getTimestampMs());
- assertEquals(message.toString(), newmsg.toString());
- assertEquals(message, newmsg);
-
- newmsg.setTimestampMs(1);
- assertNotEquals(message, newmsg);
+ newMsg = new PdpMessage(message);
+ newMsg.setRequestId(message.getRequestId());
+ newMsg.setTimestampMs(message.getTimestampMs());
+ assertEquals(message.toString(), newMsg.toString());
+ assertEquals(message, newMsg);
+
+ newMsg.setTimestampMs(1);
+ assertNotEquals(message, newMsg);
}
@Test
- public void testAppliesTo_NameCombos() {
- /*
- * Test cases where the name matches.
- */
- for (String msgGroup : new String[] {null, PDP_GROUP, DIFFERENT}) {
- for (String msgSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) {
+ void testAppliesTo_NameCombos() {
+ // Test cases where the name matches.
+ for (String msgGroup : new String[]{null, PDP_GROUP, DIFFERENT}) {
+ for (String msgSubgroup : new String[]{null, PDP_SUBGROUP, DIFFERENT}) {
message = makeMessage(PDP_NAME, msgGroup, msgSubgroup);
testName(PDP_NAME, true);
}
}
- /*
- * Test cases where the name does not match.
- */
- for (String msgGroup : new String[] {null, PDP_GROUP, DIFFERENT}) {
- for (String msgSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) {
+ // Test cases where the name does not match.
+ for (String msgGroup : new String[]{null, PDP_GROUP, DIFFERENT}) {
+ for (String msgSubgroup : new String[]{null, PDP_SUBGROUP, DIFFERENT}) {
message = makeMessage(PDP_NAME, msgGroup, msgSubgroup);
testName(DIFFERENT, false);
}
@@ -87,75 +88,60 @@ public class PdpMessageTest {
}
private void testName(String pdpName, boolean expectMatch) {
- for (String pdpGroup : new String[] {null, PDP_GROUP, DIFFERENT}) {
- for (String pdpSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) {
- assertEquals("name msg " + message + PDP_GROUP_MSG + pdpGroup + "/" + pdpSubgroup, expectMatch,
- message.appliesTo(pdpName, pdpGroup, pdpSubgroup));
+ for (String pdpGroup : new String[]{null, PDP_GROUP, DIFFERENT}) {
+ for (String pdpSubgroup : new String[]{null, PDP_SUBGROUP, DIFFERENT}) {
+ assertEquals(expectMatch, message.appliesTo(pdpName, pdpGroup, pdpSubgroup),
+ "name msg " + message + PDP_GROUP_MSG + pdpGroup + "/" + pdpSubgroup);
}
}
}
@Test
- public void testAppliesTo_BroadcastGroup() {
- /*
- * Test cases where the group matches.
- */
- for (String msgSubgroup : new String[] {null, PDP_SUBGROUP}) {
+ void testAppliesTo_BroadcastGroup() {
+ // Test cases where the group matches.
+ for (String msgSubgroup : new String[]{null, PDP_SUBGROUP}) {
message = makeMessage(null, PDP_GROUP, msgSubgroup);
-
- assertTrue("group msg " + message, message.appliesTo(PDP_NAME, PDP_GROUP, PDP_SUBGROUP));
+ assertTrue(message.appliesTo(PDP_NAME, PDP_GROUP, PDP_SUBGROUP), "group msg " + message);
}
- /*
- * Test cases where the group does not match.
- */
- for (String msgGroup : new String[] {null, PDP_GROUP}) {
- for (String msgSubgroup : new String[] {null, PDP_SUBGROUP}) {
+ // Test cases where the group does not match.
+ for (String msgGroup : new String[]{null, PDP_GROUP}) {
+ for (String msgSubgroup : new String[]{null, PDP_SUBGROUP}) {
message = makeMessage(null, msgGroup, msgSubgroup);
-
- for (String pdpGroup : new String[] {null, DIFFERENT}) {
- assertFalse("group msg " + message + PDP_GROUP_MSG + pdpGroup,
- message.appliesTo(PDP_NAME, pdpGroup, PDP_SUBGROUP));
+ for (String pdpGroup : new String[]{null, DIFFERENT}) {
+ assertFalse(message.appliesTo(PDP_NAME, pdpGroup, PDP_SUBGROUP),
+ "group msg " + message + PDP_GROUP_MSG + pdpGroup);
}
}
}
}
@Test
- public void testAppliesTo_BroadcastSubGroup() {
- /*
- * Test cases where the subgroup matches.
- */
+ void testAppliesTo_BroadcastSubGroup() {
+ // Test cases where the subgroup matches.
message = makeMessage(null, PDP_GROUP, PDP_SUBGROUP);
- assertTrue("subgroup msg " + message, message.appliesTo(PDP_NAME, PDP_GROUP, PDP_SUBGROUP));
+ assertTrue(message.appliesTo(PDP_NAME, PDP_GROUP, PDP_SUBGROUP), "subgroup msg " + message);
- /*
- * Test cases where the subgroup does not match.
- */
+ // Test cases where the subgroup does not match.
message = makeMessage(null, PDP_GROUP, PDP_SUBGROUP);
-
- for (String pdpSubgroup : new String[] {null, DIFFERENT}) {
- assertFalse("subgroup msg " + message + " pdp subgroup " + pdpSubgroup,
- message.appliesTo(PDP_NAME, PDP_GROUP, pdpSubgroup));
+ for (String pdpSubgroup : new String[]{null, DIFFERENT}) {
+ assertFalse(message.appliesTo(PDP_NAME, PDP_GROUP, pdpSubgroup),
+ "subgroup msg " + message + " pdp subgroup " + pdpSubgroup);
}
}
@Test
- public void testAppliesTo_NullPdpName() {
+ void testAppliesTo_NullPdpName() {
message = makeMessage(PDP_NAME, PDP_GROUP, PDP_SUBGROUP);
-
assertThatThrownBy(() -> message.appliesTo(null, PDP_GROUP, PDP_SUBGROUP))
- .isInstanceOf(NullPointerException.class);
-
+ .isInstanceOf(NullPointerException.class);
}
private PdpMessage makeMessage(String pdpName, String pdpGroup, String pdpSubgroup) {
PdpMessage msg = new PdpMessage(PdpMessageType.PDP_STATE_CHANGE);
-
msg.setName(pdpName);
msg.setPdpGroup(pdpGroup);
msg.setPdpSubgroup(pdpSubgroup);
-
return msg;
}
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java
index f21a0a5bb..617cb651b 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,16 +22,16 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
-public class PdpResponseDetailsTest {
+class PdpResponseDetailsTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpResponseDetails(null)).isInstanceOf(NullPointerException.class);
PdpResponseDetails orig = new PdpResponseDetails();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java
index aa715b775..9bc9c3451 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,19 +22,19 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpState;
/**
* Test the copy constructor, as {@link ModelsTest} tests the other methods.
*/
-public class PdpStateChangeTest {
+class PdpStateChangeTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpStateChange(null)).isInstanceOf(NullPointerException.class);
PdpStateChange orig = new PdpStateChange();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java
index 07afd4098..89a40995a 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2024 Nordix Foundation.
* Modifications Copyright (C) 2023 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,20 +23,20 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-public class PdpStatusTest {
+class PdpStatusTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpStatus(null)).isInstanceOf(NullPointerException.class);
final PdpStatus orig = new PdpStatus();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java
index 7d3d4ab92..226d86489 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,17 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -42,12 +42,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test methods not tested by {@link ModelsTest}.
*/
-public class PdpSubGroupTest {
+class PdpSubGroupTest {
private static final String VERSION_300 = "3.0.0";
private static final Coder coder = new StandardCoder();
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpSubGroup(null)).isInstanceOf(NullPointerException.class);
final PdpSubGroup orig = new PdpSubGroup();
@@ -90,7 +90,7 @@ public class PdpSubGroupTest {
}
@Test
- public void testValidatePapRest_GroupUpdateFlow() throws Exception {
+ void testValidatePapRest_GroupUpdateFlow() throws Exception {
PdpSubGroup subgrp = new PdpSubGroup();
// with supported policy type and policies
subgrp.setDesiredInstanceCount(1);
@@ -123,7 +123,7 @@ public class PdpSubGroupTest {
}
@Test
- public void testValidatePapRest() throws Exception {
+ void testValidatePapRest() throws Exception {
PdpSubGroup subgrp = new PdpSubGroup();
subgrp.setDesiredInstanceCount(1);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java
index 270278ab1..13e090371 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,18 +22,18 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the copy constructor, as {@link ModelsTest} tests the other methods.
*/
-public class PdpTopicCheckTest {
+class PdpTopicCheckTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpTopicCheck(null)).isInstanceOf(NullPointerException.class);
PdpTopicCheck orig = new PdpTopicCheck();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
index 13ee54b52..711d8593c 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,23 +22,23 @@
package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Test the copy constructor, as {@link ModelsTest} tests the other methods.
*/
-public class PdpUpdateTest {
+class PdpUpdateTest {
@Test
- public void testCopyConstructor() {
+ void testCopyConstructor() {
assertThatThrownBy(() -> new PdpUpdate(null)).isInstanceOf(NullPointerException.class);
PdpUpdate orig = new PdpUpdate();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
index 060f650fb..95d10365c 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,17 +22,17 @@
package org.onap.policy.models.pdp.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.pdp.concepts.PdpGroup;
@@ -44,7 +44,7 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class JpaPdpGroupTest {
+class JpaPdpGroupTest {
private static final String NULL_ERROR = " is marked .*ull but is null";
private static final String NULL_KEY_ERROR = "key" + NULL_ERROR;
@@ -52,7 +52,7 @@ public class JpaPdpGroupTest {
private static final String VERSION = "1.0.0";
@Test
- public void testJpaPdpGroup() {
+ void testJpaPdpGroup() {
assertThatThrownBy(() -> {
new JpaPdpGroup((JpaPdpGroup) null);
}).hasMessageMatching("copyConcept" + NULL_ERROR);
@@ -98,7 +98,7 @@ public class JpaPdpGroupTest {
}
@Test
- public void testPdpGroupSet() {
+ void testPdpGroupSet() {
PdpGroup testPdpGroup = new PdpGroup();
testPdpGroup.setName(PDP_GROUP0);
testPdpGroup.setPdpSubgroups(new ArrayList<>());
@@ -125,7 +125,7 @@ public class JpaPdpGroupTest {
}
@Test
- public void testPdpGroupValidation() {
+ void testPdpGroupValidation() {
JpaPdpGroup testJpaPdpGroup = setUpSmallJpaPdpGroup();
assertThatThrownBy(() -> {
@@ -162,7 +162,7 @@ public class JpaPdpGroupTest {
}
@Test
- public void testPdpSubgroups() {
+ void testPdpSubgroups() {
JpaPdpGroup testJpaPdpGroup = setUpJpaPdpGroup();
List<JpaPdpSubGroup> jpaPdpSubgroups = testJpaPdpGroup.getPdpSubGroups();
@@ -221,7 +221,7 @@ public class JpaPdpGroupTest {
}
@Test
- public void testPdpGroupsProperties() {
+ void testPdpGroupsProperties() {
JpaPdpGroup testJpaPdpGroup = setUpJpaPdpGroup();
testJpaPdpGroup.getProperties().put(" PropKey ", " Prop Value ");
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java
index fdadae768..ecc9b81cd 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +23,15 @@ package org.onap.policy.models.pdp.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.UnaryOperator;
import org.assertj.core.api.AbstractStringAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfKey;
import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.Validated;
@@ -39,7 +40,7 @@ import org.onap.policy.models.pdp.concepts.PdpPolicyStatus.PdpPolicyStatusBuilde
import org.onap.policy.models.pdp.concepts.PdpPolicyStatus.State;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-public class JpaPdpPolicyStatusTest {
+class JpaPdpPolicyStatusTest {
private static final String MY_PDP = "MyPdp";
private static final String MY_GROUP = "MyGroup";
private static final String MY_PDP_TYPE = "MyPdpType";
@@ -52,8 +53,8 @@ public class JpaPdpPolicyStatusTest {
/**
* Set up Policy Status builder.
*/
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
// @formatter:off
builder = PdpPolicyStatus.builder()
.deploy(true)
@@ -67,7 +68,7 @@ public class JpaPdpPolicyStatusTest {
}
@Test
- public void testJpaPdpPolicyStatus() {
+ void testJpaPdpPolicyStatus() {
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus();
assertThat(jpa.getKey()).isNotNull();
@@ -81,14 +82,14 @@ public class JpaPdpPolicyStatusTest {
}
@Test
- public void testJpaPdpPolicyStatusJpaPdpPolicyStatus() {
+ void testJpaPdpPolicyStatusJpaPdpPolicyStatus() {
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus(builder.build());
assertThat(new JpaPdpPolicyStatus(jpa)).isEqualTo(jpa);
}
@Test
- public void testJpaPdpPolicyStatusPdpPolicyStatus() {
+ void testJpaPdpPolicyStatusPdpPolicyStatus() {
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus(builder.build());
assertThat(jpa.getKey()).isNotNull();
@@ -110,14 +111,14 @@ public class JpaPdpPolicyStatusTest {
}
@Test
- public void testGetKeys() {
+ void testGetKeys() {
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus(builder.build());
assertThat(jpa.getKeys()).isEqualTo(List.of(jpa.getKey()));
}
@Test
- public void testClean() {
+ void testClean() {
JpaPdpPolicyStatus jpa =
new JpaPdpPolicyStatus(builder.pdpGroup(MY_GROUP + " ").pdpType(MY_PDP_TYPE + " ").build());
@@ -129,7 +130,7 @@ public class JpaPdpPolicyStatusTest {
@Test
@SuppressWarnings("serial")
- public void testCompareTo() {
+ void testCompareTo() {
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus(builder.build());
assertNotEquals(0, jpa.compareTo(null));
@@ -153,14 +154,14 @@ public class JpaPdpPolicyStatusTest {
}
@Test
- public void testToAuthorative() {
+ void testToAuthorative() {
PdpPolicyStatus data = builder.build();
assertThat(new JpaPdpPolicyStatus(data).toAuthorative()).isEqualTo(data);
}
@Test
- public void testFromAuthorative() {
+ void testFromAuthorative() {
PdpPolicyStatus data = builder.build();
JpaPdpPolicyStatus jpa = new JpaPdpPolicyStatus();
@@ -170,7 +171,7 @@ public class JpaPdpPolicyStatusTest {
}
@Test
- public void testValidate() {
+ void testValidate() {
assertThat(new JpaPdpPolicyStatus(builder.build()).validate("").getResult()).isNull();
assertThatThrownBy(() -> new JpaPdpPolicyStatus(builder.build()).validate(null))
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
index 566de0d98..5690daa4a 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,17 +23,17 @@ package org.onap.policy.models.pdp.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.PfSearchableKey;
@@ -46,13 +46,13 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class JpaPdpSubGroupTest {
+class JpaPdpSubGroupTest {
private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
private static final String PDP_A = "PDP-A";
@Test
- public void testJpaPdpSubGroupErrors() {
+ void testJpaPdpSubGroupErrors() {
assertThatThrownBy(() -> {
new JpaPdpSubGroup((JpaPdpSubGroup) null);
}).hasMessageMatching("copyConcept is marked .*ull but is null");
@@ -117,7 +117,7 @@ public class JpaPdpSubGroupTest {
}
@Test
- public void testJpaPdpSubGroup() {
+ void testJpaPdpSubGroup() {
PdpSubGroup testPdpSubgroup = new PdpSubGroup();
testPdpSubgroup.setPdpType(PDP_A);
JpaPdpSubGroup testJpaPdpSubGroup = new JpaPdpSubGroup();
@@ -160,7 +160,7 @@ public class JpaPdpSubGroupTest {
}
@Test
- public void testJpaPdpSubGroupSavedKey() {
+ void testJpaPdpSubGroupSavedKey() {
JpaPdpSubGroup testJpaPdpSubGroup = setUpJpaPdpSubGroup();
PfReferenceKey savedKey = testJpaPdpSubGroup.getKey();
@@ -196,7 +196,7 @@ public class JpaPdpSubGroupTest {
}
@Test
- public void testJpaPdpSubGroupPolicyTypes() {
+ void testJpaPdpSubGroupPolicyTypes() {
JpaPdpSubGroup testJpaPdpSubGroup = setUpJpaPdpSubGroup();
List<PfSearchableKey> supportedPolicyTypes = testJpaPdpSubGroup.getSupportedPolicyTypes();
@@ -228,7 +228,7 @@ public class JpaPdpSubGroupTest {
}
@Test
- public void testJpaPdpSubGroupKeys() {
+ void testJpaPdpSubGroupKeys() {
JpaPdpSubGroup testJpaPdpSubGroup = setUpJpaPdpSubGroup();
JpaPdpSubGroup otherJpaPdpSubGroup = new JpaPdpSubGroup(testJpaPdpSubGroup);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
index ab592f510..395dea3f5 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,14 +23,14 @@ package org.onap.policy.models.pdp.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Date;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.Validated;
@@ -44,14 +44,14 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpChild;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class JpaPdpTest {
+class JpaPdpTest {
private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
private static final String PDP1 = "ThePDP";
private static final Date CURRENT_DATE = new Date();
@Test
- public void testJpaPdp() {
+ void testJpaPdp() {
assertThatThrownBy(() -> {
new JpaPdp((JpaPdp) null);
}).hasMessageMatching("copyConcept is marked .*ull but is null");
@@ -88,7 +88,7 @@ public class JpaPdpTest {
}
@Test
- public void testJpaPdpInstace() {
+ void testJpaPdpInstace() {
Pdp testPdp = new Pdp();
testPdp.setInstanceId(PDP1);
JpaPdp testJpaPdp = new JpaPdp();
@@ -117,7 +117,7 @@ public class JpaPdpTest {
}
@Test
- public void testJpaPdpValidation() {
+ void testJpaPdpValidation() {
Pdp testPdp = new Pdp();
testPdp.setInstanceId(PDP1);
JpaPdp testJpaPdp = new JpaPdp();
@@ -155,7 +155,7 @@ public class JpaPdpTest {
}
@Test
- public void testJpaPdpValidationSwapKey() {
+ void testJpaPdpValidationSwapKey() {
JpaPdp testJpaPdp = setUpJpaPdp();
PfReferenceKey savedKey = testJpaPdp.getKey();
@@ -173,7 +173,7 @@ public class JpaPdpTest {
}
@Test
- public void testJpaPdpCompare_testToAuthorative() {
+ void testJpaPdpCompare_testToAuthorative() {
JpaPdp testJpaPdp = setUpJpaPdp();
JpaPdp otherJpaPdp = new JpaPdp(testJpaPdp);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
index 58ff7f171..998ccf6af 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,15 +24,15 @@ package org.onap.policy.models.pdp.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class PdpFilterParametersTest {
+class PdpFilterParametersTest {
private static final String GROUP = "my-group";
private static final String SUBGROUP = "my-subgroup";
@Test
- public void testGetFilterMap() {
+ void testGetFilterMap() {
assertThat(PdpFilterParameters.builder().build().getFilterMap()).isNull();
assertThat(PdpFilterParameters.builder().subGroup(SUBGROUP).build().getFilterMap()).isNull();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
index 4c6a46142..85d68ae80 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
@@ -25,17 +25,17 @@ package org.onap.policy.models.pdp.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
@@ -64,7 +64,7 @@ import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class PdpProviderTest {
+class PdpProviderTest {
private static final String PDP_GROUPS0_JSON = "testdata/PdpGroups0.json";
private static final String PDP_TYPE_IS_NULL = "pdpType is marked .*ull but is null";
private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked .*ull but is null";
@@ -85,8 +85,8 @@ public class PdpProviderTest {
*
* @throws Exception on database errors
*/
- @Before
- public void setupDao() throws Exception {
+ @BeforeEach
+ void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass(DefaultPfDao.class.getName());
@@ -113,29 +113,29 @@ public class PdpProviderTest {
/**
* Set up GSON.
*/
- @Before
- public void setupGson() {
+ @BeforeEach
+ void setupGson() {
standardCoder = new StandardCoder();
}
/**
* Set up Policy Status builder.
*/
- @Before
- public void setupBuilder() {
+ @BeforeEach
+ void setupBuilder() {
ToscaConceptIdentifier policyType = new ToscaConceptIdentifier("MyPolicyType", "1.2.4");
statusBuilder = PdpPolicyStatus.builder().deploy(true).pdpType("MyPdpType").policy(MY_POLICY)
.policyType(policyType).state(State.SUCCESS);
}
- @After
- public void teardown() {
+ @AfterEach
+ void teardown() {
pfDao.close();
}
@Test
- public void testGroupsGet() throws Exception {
+ void testGroupsGet() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().getPdpGroups(null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -161,7 +161,7 @@ public class PdpProviderTest {
}
@Test
- public void testFilteredPdpGroupGet() throws Exception {
+ void testFilteredPdpGroupGet() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().getFilteredPdpGroups(null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -201,7 +201,7 @@ public class PdpProviderTest {
}
@Test
- public void testGroupsCreate() throws Exception {
+ void testGroupsCreate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().createPdpGroups(null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -236,7 +236,7 @@ public class PdpProviderTest {
}
@Test
- public void testGroupsCreateNoPdp() throws Exception {
+ void testGroupsCreateNoPdp() throws Exception {
String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroupsNoPDPs.json");
PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
@@ -257,7 +257,7 @@ public class PdpProviderTest {
}
@Test
- public void testGroupsUpdate() throws Exception {
+ void testGroupsUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdpGroups(null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -302,7 +302,7 @@ public class PdpProviderTest {
}
@Test
- public void testPoliciesDelete() throws Exception {
+ void testPoliciesDelete() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().deletePdpGroup(null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -345,7 +345,7 @@ public class PdpProviderTest {
}
@Test
- public void testPdpSubgroupUpdate() throws Exception {
+ void testPdpSubgroupUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(null, null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -410,7 +410,7 @@ public class PdpProviderTest {
}
@Test
- public void testPdpUpdate() throws Exception {
+ void testPdpUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, null, null, null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -508,7 +508,7 @@ public class PdpProviderTest {
}
@Test
- public void testGetAllPolicyStatusPfDao() throws PfModelException {
+ void testGetAllPolicyStatusPfDao() {
assertThatThrownBy(() -> {
new PdpProvider().getAllPolicyStatus(null);
}).hasMessageMatching(DAO_IS_NULL);
@@ -536,7 +536,7 @@ public class PdpProviderTest {
}
@Test
- public void testGetAllPolicyStatusPfDaoToscaConceptIdentifierOptVersion() throws PfModelException {
+ void testGetAllPolicyStatusPfDaoToscaConceptIdentifierOptVersion() {
assertThatThrownBy(() -> {
new PdpProvider().getAllPolicyStatus(null, new ToscaConceptIdentifierOptVersion("somePdp", null));
}).hasMessageMatching(DAO_IS_NULL);
@@ -555,7 +555,7 @@ public class PdpProviderTest {
}
@Test
- public void testGetGroupPolicyStatus() throws PfModelException {
+ void testGetGroupPolicyStatus() {
assertThatThrownBy(() -> {
new PdpProvider().getGroupPolicyStatus(null, "someGroup");
}).hasMessageMatching(DAO_IS_NULL);
@@ -571,7 +571,7 @@ public class PdpProviderTest {
}
@Test
- public void cudPolicyStatus() throws PfModelException {
+ void cudPolicyStatus() {
PdpProvider prov = new PdpProvider();
assertThatThrownBy(() -> prov.cudPolicyStatus(null, List.of(), List.of(), List.of()))
@@ -582,7 +582,7 @@ public class PdpProviderTest {
}
@Test
- public void cudPolicyStatus_Create() throws PfModelException {
+ void cudPolicyStatus_Create() {
PdpProvider prov = new PdpProvider();
PdpPolicyStatus idx = statusBuilder.pdpGroup(GROUP_A).pdpId("idX").build();
@@ -604,7 +604,7 @@ public class PdpProviderTest {
}
@Test
- public void cudPolicyStatus_Update() throws PfModelException {
+ void cudPolicyStatus_Update() {
PdpProvider prov = new PdpProvider();
PdpPolicyStatus idw = statusBuilder.pdpGroup(GROUP_A).pdpId("wId").build();
@@ -632,7 +632,7 @@ public class PdpProviderTest {
}
@Test
- public void cudPolicyStatus_Delete() throws PfModelException {
+ void cudPolicyStatus_Delete() {
PdpProvider prov = new PdpProvider();
PdpPolicyStatus idw = statusBuilder.pdpGroup(GROUP_A).pdpId("idW").build();
@@ -657,7 +657,7 @@ public class PdpProviderTest {
}
@Test
- public void testFromAuthorativeStatus() throws PfModelException {
+ void testFromAuthorativeStatus() {
PdpProvider prov = new PdpProvider();
assertThatCode(() -> prov.cudPolicyStatus(pfDao, null, null, null)).doesNotThrowAnyException();
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java
index 79fce30a8..5fa6e809c 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,7 @@ package org.onap.policy.models.provider;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the {@link PolicyModelsProviderFactory} class.
@@ -32,10 +32,10 @@ import org.junit.Test;
* @author Liam Fallon (liam.fallon@est.tech)
*/
@ToString
-public class PolicyModelsProviderFactoryTest {
+class PolicyModelsProviderFactoryTest {
@Test
- public void testFactory() {
+ void testFactory() {
PolicyModelsProviderFactory factory = new PolicyModelsProviderFactory();
// @formatter:off
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java
index b1ae2a876..db59460a7 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,10 +21,10 @@
package org.onap.policy.models.provider;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
/**
@@ -32,10 +32,10 @@ import org.onap.policy.common.parameters.ValidationResult;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class PolicyModelsProviderParametersTest {
+class PolicyModelsProviderParametersTest {
@Test
- public void testParameters() {
+ void testParameters() {
PolicyModelsProviderParameters pars = new PolicyModelsProviderParameters();
pars.setDatabaseDriver("MichaelsShumacher");
pars.setDatabaseUrl("jdbc://www.acmecorp/roadrunner");
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java b/models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java
index 9ffe35cb0..f85674e70 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import com.openpojo.validation.rule.impl.GetterMustExistRule;
import com.openpojo.validation.rule.impl.SetterMustExistRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Class to perform unit tests of all pojos.
@@ -35,12 +35,12 @@ import org.junit.Test;
* @author liam.fallon@est.tech)
*
*/
-public class TestPojos {
+class TestPojos {
private static final String POJO_PACKAGE = "org.onap.policy.models.provider";
@Test
- public void testPojos() {
+ void testPojos() {
// @formatter:off
final Validator validator = ValidatorBuilder
.create()
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index 2af0f0cec..16d4ee4ac 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -23,16 +23,16 @@
package org.onap.policy.models.provider.impl;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
@@ -58,7 +58,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class DatabasePolicyModelsProviderTest {
+class DatabasePolicyModelsProviderTest {
private static final String NAME = "name";
private static final String TEMPLATE_IS_NULL = "^serviceTemplate is marked .*on.*ull but is null$";
@@ -75,15 +75,15 @@ public class DatabasePolicyModelsProviderTest {
private static final String VERSION_100 = "1.0.0";
- private PolicyModelsProviderParameters parameters;
+ private static PolicyModelsProviderParameters parameters;
- private PolicyModelsProvider databaseProvider;
+ private static PolicyModelsProvider databaseProvider;
/**
* Initialize parameters.
*/
- @Before
- public void setupParameters() {
+ @BeforeAll
+ public static void setupParameters() {
parameters = new PolicyModelsProviderParameters();
parameters.setDatabaseDriver("org.h2.Driver");
parameters.setDatabaseUrl("jdbc:h2:mem:DatabasePolicyModelsProviderTest");
@@ -95,15 +95,15 @@ public class DatabasePolicyModelsProviderTest {
/**
* Closes the DB.
*/
- @After
- public void tearDown() throws PfModelException {
+ @AfterAll
+ public static void tearDown() throws PfModelException {
if (databaseProvider != null) {
databaseProvider.close();
}
}
@Test
- public void testInitAndClose() throws Exception {
+ void testInitAndClose() throws Exception {
assertThatThrownBy(() -> {
new DatabasePolicyModelsProviderImpl(null);
}).hasMessageMatching("^parameters is marked .*on.*ull but is null$");
@@ -142,7 +142,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testProviderMethodsNull() throws Exception {
+ void testProviderMethodsNull() throws Exception {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
@@ -204,7 +204,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testProviderMethodsNullGroup() throws Exception {
+ void testProviderMethodsNullGroup() throws Exception {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
@@ -276,7 +276,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testProviderMethodsNotInit() throws Exception {
+ void testProviderMethodsNotInit() throws Exception {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
databaseProvider.close();
@@ -287,7 +287,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testProviderMethods() throws PfModelException {
+ void testProviderMethods() throws PfModelException {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
assertThatThrownBy(() -> databaseProvider.getPolicyTypes(NAME, VERSION_100))
@@ -344,7 +344,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testProviderMethodsInGroups() throws PfModelException {
+ void testProviderMethodsInGroups() throws PfModelException {
PdpGroup pdpGroup = new PdpGroup();
pdpGroup.setName(GROUP);
pdpGroup.setVersion("1.2.3");
@@ -394,7 +394,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testDeletePolicyDeployedInSubgroup() throws PfModelException {
+ void testDeletePolicyDeployedInSubgroup() throws PfModelException {
List<ToscaConceptIdentifier> policies = new ArrayList<>();
policies.add(new ToscaConceptIdentifier("p0", "0.0.1"));
@@ -433,7 +433,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testDeletePolicyTypeSupportedInSubgroup() throws PfModelException {
+ void testDeletePolicyTypeSupportedInSubgroup() throws PfModelException {
List<ToscaConceptIdentifier> supportedPolicyTypes = new ArrayList<>();
supportedPolicyTypes.add(new ToscaConceptIdentifier("pt1", "0.0.1"));
supportedPolicyTypes.add(new ToscaConceptIdentifier("pt2", "0.0.1"));
@@ -467,7 +467,7 @@ public class DatabasePolicyModelsProviderTest {
}
@Test
- public void testToscaNodeTemplateHandling() throws PfModelException {
+ void testToscaNodeTemplateHandling() throws PfModelException {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
ToscaServiceTemplate serviceTemplate = makeNodeTemplate();
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
index a1339e4fd..c391680e5 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2023 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved.
* ================================================================================
@@ -28,7 +28,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import lombok.NonNull;
-import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
index 628aef96e..fe5af6b2f 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2024 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved.
* ================================================================================
@@ -25,13 +25,13 @@ package org.onap.policy.models.provider.impl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
@@ -51,12 +51,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class DummyPolicyModelsProviderTest {
+class DummyPolicyModelsProviderTest {
private static final String VERSION = "version";
@Test
- public void testProvider() throws Exception {
+ void testProvider() throws Exception {
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getName());
parameters.setDatabaseUrl("jdbc:dummy");
@@ -75,7 +75,7 @@ public class DummyPolicyModelsProviderTest {
}
@Test
- public void testProviderMethods() throws Exception {
+ void testProviderMethods() throws Exception {
PolicyModelsProvider dummyProvider = setUpDummyProvider();
dummyProvider.init();
@@ -103,7 +103,7 @@ public class DummyPolicyModelsProviderTest {
}
@Test
- public void testProviderMethodsParameters() throws Exception {
+ void testProviderMethodsParameters() throws Exception {
PolicyModelsProvider dummyProvider = setUpDummyProvider();
dummyProvider.init();
@@ -119,7 +119,7 @@ public class DummyPolicyModelsProviderTest {
}
@Test
- public void testDummyResponse() {
+ void testDummyResponse() {
try (DummyPolicyModelsProviderSubImpl resp =
new DummyPolicyModelsProviderSubImpl(new PolicyModelsProviderParameters())) {
assertThatThrownBy(resp::getBadDummyResponse1).hasMessage("error serializing object");
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
index 3db058c27..227f1866f 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
@@ -23,8 +23,8 @@
package org.onap.policy.models.provider.impl;
import static org.assertj.core.api.Assertions.assertThatCode;
-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.net.URISyntaxException;
import java.util.LinkedHashMap;
@@ -34,9 +34,9 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import lombok.NonNull;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
@@ -58,13 +58,13 @@ import org.slf4j.LoggerFactory;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class PolicyToscaPersistenceTest {
+class PolicyToscaPersistenceTest {
private static final Logger LOGGER = LoggerFactory.getLogger(PolicyToscaPersistenceTest.class);
- private YamlJsonTranslator yamlJsonTranslator = new YamlJsonTranslator();
+ private static YamlJsonTranslator yamlJsonTranslator = new YamlJsonTranslator();
private StandardCoder standardCoder = new StandardCoder();
- private PolicyModelsProvider databaseProvider;
+ private static PolicyModelsProvider databaseProvider;
/**
* Initialize provider.
@@ -72,8 +72,8 @@ public class PolicyToscaPersistenceTest {
* @throws PfModelException on exceptions in the tests
* @throws CoderException on JSON encoding and decoding errors
*/
- @Before
- public void setupParameters() throws Exception {
+ @BeforeAll
+ public static void setupParameters() throws Exception {
// H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
@@ -96,13 +96,13 @@ public class PolicyToscaPersistenceTest {
createPolicyTypes();
}
- @After
- public void teardown() throws Exception {
+ @AfterAll
+ public static void teardown() throws Exception {
databaseProvider.close();
}
@Test
- public void testToscaPolicyPersistence() throws Exception {
+ void testToscaPolicyPersistence() throws Exception {
Set<String> policyResources = ResourceUtils.getDirectoryContents("policies");
for (String policyResource : policyResources) {
@@ -121,7 +121,7 @@ public class PolicyToscaPersistenceTest {
}
@Test
- public void testHpaPolicyTypeGet() throws PfModelException {
+ void testHpaPolicyTypeGet() throws PfModelException {
long getStartTime = System.currentTimeMillis();
ToscaServiceTemplate hpaServiceTemplate =
databaseProvider.getPolicyTypes("onap.policies.optimization.resource.HpaPolicy", "1.0.0");
@@ -150,7 +150,7 @@ public class PolicyToscaPersistenceTest {
}
@Test
- public void testNamingPolicyGet() throws PfModelException {
+ void testNamingPolicyGet() throws PfModelException {
String policyYamlString = ResourceUtils.getResourceAsString("policies/sdnc.policy.naming.input.tosca.yaml");
ToscaServiceTemplate serviceTemplate =
yamlJsonTranslator.fromYaml(policyYamlString, ToscaServiceTemplate.class);
@@ -196,7 +196,7 @@ public class PolicyToscaPersistenceTest {
}
@Test
- public void testNamingPolicyVersions() throws PfModelException {
+ void testNamingPolicyVersions() throws PfModelException {
String policyYamlString = ResourceUtils.getResourceAsString("policies/sdnc.policy.naming.input.tosca.yaml");
ToscaServiceTemplate serviceTemplate =
yamlJsonTranslator.fromYaml(policyYamlString, ToscaServiceTemplate.class);
@@ -252,7 +252,7 @@ public class PolicyToscaPersistenceTest {
* @param serviceTemplate the service template containing the policy
* @throws Exception any exception thrown
*/
- public void testPolicyPersistence(@NonNull final ToscaServiceTemplate serviceTemplate) throws Exception {
+ void testPolicyPersistence(@NonNull final ToscaServiceTemplate serviceTemplate) throws Exception {
assertNotNull(serviceTemplate);
CountDownLatch threadCountDownLatch = new CountDownLatch(10);
@@ -306,7 +306,7 @@ public class PolicyToscaPersistenceTest {
return toscaPolicy;
}
- private void createPolicyTypes() throws CoderException, PfModelException, URISyntaxException {
+ private static void createPolicyTypes() throws PfModelException {
Set<String> policyTypeResources = ResourceUtils.getDirectoryContents("policytypes");
for (String policyTypeResource : policyTypeResources) {
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
index 11e8381af..30824eb3a 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
@@ -24,15 +24,15 @@ package org.onap.policy.models.provider.impl;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
@@ -48,17 +48,17 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
-public class PolicyTypePersistenceTest {
+class PolicyTypePersistenceTest {
private YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
- private PolicyModelsProvider databaseProvider;
+ private static PolicyModelsProvider databaseProvider;
/**
* Initialize provider.
*
* @throws PfModelException on exceptions in the tests
*/
- @Before
- public void setupParameters() throws PfModelException {
+ @BeforeAll
+ public static void setupParameters() throws PfModelException {
// H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
@@ -78,13 +78,13 @@ public class PolicyTypePersistenceTest {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
}
- @After
- public void teardown() throws Exception {
+ @AfterAll
+ public static void teardown() throws Exception {
databaseProvider.close();
}
@Test
- public void testPolicyTypePersistence() throws Exception {
+ void testPolicyTypePersistence() throws Exception {
Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes");
ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java
index 015bbc552..a4a2014df 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java
@@ -23,14 +23,14 @@
package org.onap.policy.models.provider.revisionhierarchy;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.common.utils.resources.TextFileUtils;
import org.onap.policy.models.base.PfModelException;
@@ -41,13 +41,13 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-public class HierarchyFetchTest {
+class HierarchyFetchTest {
private static PolicyModelsProviderParameters parameters;
- private PolicyModelsProvider databaseProvider;
+ private static PolicyModelsProvider databaseProvider;
- @BeforeClass
+ @BeforeAll
public static void beforeSetupParameters() {
parameters = new PolicyModelsProviderParameters();
parameters.setDatabaseDriver("org.h2.Driver");
@@ -60,15 +60,15 @@ public class HierarchyFetchTest {
/**
* Closes the DB.
*/
- @After
- public void tearDown() throws PfModelException {
+ @AfterAll
+ public static void tearDown() throws PfModelException {
if (databaseProvider != null) {
databaseProvider.close();
}
}
@Test
- public void testMultipleVersions() throws Exception {
+ void testMultipleVersions() throws Exception {
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
ToscaServiceTemplate serviceTemplate = new YamlJsonTranslator().fromYaml(