Convert models to JUnit 5 09/138309/2
authorwaynedunican <wayne.dunican@est.tech>
Thu, 13 Jun 2024 08:27:35 +0000 (09:27 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Tue, 25 Jun 2024 08:16:30 +0000 (09:16 +0100)
Review for models-pap, models-pdp and models-provider

Issue-ID: POLICY-5042
Change-Id: Ic00d60127f11472f585e4cbda2b2272c220cd225
Signed-off-by: waynedunican <wayne.dunican@est.tech>
38 files changed:
models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponseTest.java
models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyNotificationTest.java
models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
models-pap/src/test/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAuditTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatisticsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetailsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpResponseDetailsTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStateChangeTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpTopicCheckTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatusTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderFactoryTest.java
models-provider/src/test/java/org/onap/policy/models/provider/PolicyModelsProviderParametersTest.java
models-provider/src/test/java/org/onap/policy/models/provider/TestPojos.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java

index 2ab315d..6036ad9 100644 (file)
@@ -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.
 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();
index 3664cc3..0ba0bfd 100644 (file)
@@ -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.
 
 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();
index d3b8cc4..315ee9b 100644 (file)
@@ -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.
 
 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));
index 10c7c5f..c6b88ab 100644 (file)
@@ -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.
 
 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();
index 997c304..0f1c4b9 100644 (file)
@@ -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");
 
index 1658ccb..07b9d17 100644 (file)
@@ -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
index 25d7304..25b3219 100644 (file)
@@ -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);
index e3438ac..202ab69 100644 (file)
@@ -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.
 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);
 
index 18b1375..bc3da48 100644 (file)
@@ -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.
 
 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");
 
index 744c2e8..7b87a5c 100644 (file)
@@ -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.
 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");
index 95af265..3a9a715 100644 (file)
@@ -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();
 
index b748b91..c438d9e 100644 (file)
@@ -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.
 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();
index 89a1333..5019afa 100644 (file)
@@ -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");
 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));
index ae88f50..f5cdecf 100644 (file)
@@ -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.
 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);
 
index 5cf7c13..09d94d0 100644 (file)
@@ -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.
 
 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");
 
index e1c7667..5caa4e5 100644 (file)
@@ -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.
 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();
index 763b29a..50b211d 100644 (file)
@@ -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.
 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;
     }
 }
index f21a0a5..617cb65 100644 (file)
@@ -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.
 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();
index aa715b7..9bc9c34 100644 (file)
@@ -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.
 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();
index 07afd40..89a4099 100644 (file)
@@ -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");
 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();
index 7d3d4ab..226d864 100644 (file)
@@ -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.
 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);
index 270278a..13e0903 100644 (file)
@@ -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.
 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();
index 13ee54b..711d859 100644 (file)
@@ -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.
 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();
index 060f650..95d1036 100644 (file)
@@ -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");
 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 ");
index fdadae7..ecc9b81 100644 (file)
@@ -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))
index 566de0d..5690daa 100644 (file)
@@ -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);
index ab592f5..395dea3 100644 (file)
@@ -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);
index 58ff7f1..998ccf6 100644 (file)
@@ -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();
index 4c6a461..85d68ae 100644 (file)
@@ -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();
index 79fce30..5fa6e80 100644 (file)
@@ -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
index b1ae2a8..db59460 100644 (file)
@@ -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");
 
 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");
index 9ffe35c..f85674e 100644 (file)
@@ -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()
index 2af0f0c..16d4ee4 100644 (file)
 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();
index a1339e4..c391680 100644 (file)
@@ -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;
index 628aef9..fe5af6b 100644 (file)
@@ -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");
index 3db058c..227f186 100644 (file)
@@ -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) {
index 11e8381..30824eb 100644 (file)
@@ -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();
index 015bbc5..a4a2014 100644 (file)
 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(