Convert models to JUnit 5 90/138290/4
authorwaynedunican <wayne.dunican@est.tech>
Thu, 13 Jun 2024 08:13:33 +0000 (09:13 +0100)
committerWayne Dunican <wayne.dunican@est.tech>
Thu, 20 Jun 2024 15:48:51 +0000 (15:48 +0000)
Review for models-base, models-dao, models-decisions and models-errors

Issue-ID: POLICY-5042
Change-Id: I0fd2252dcf5c758420508facf62d70789a5e9598
Signed-off-by: waynedunican <wayne.dunican@est.tech>
28 files changed:
models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java
models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java
models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java
models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java
models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java
models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java
models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java
models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java
models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java
models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java
models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
models-decisions/src/test/java/org/onap/policy/models/decisions/concepts/TestModels.java
models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java
models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseUtilsTest.java
models-errors/src/test/java/org/onap/policy/models/errors/concepts/TestModels.java

index b92aed4..20c2ae3 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2019, 2021, 2023 Nordix Foundation.
+ * Copyright (C) 2019, 2021, 2023, 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.base;
 
-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 jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.core.Response.Status;
 import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.errors.concepts.ErrorResponse;
 
-public class ExceptionsTest {
+class ExceptionsTest {
 
     private static final String STRING_TEXT = "String";
     private static final String MESSAGE = "Message";
 
     @Test
-    public void test() {
+    void test() {
         assertNotNull(new PfModelException(Response.Status.OK, MESSAGE));
         assertNotNull(new PfModelException(Response.Status.OK, MESSAGE, STRING_TEXT));
         assertNotNull(new PfModelException(Response.Status.OK, MESSAGE, new IOException()));
index 60ae85d..b4461e8 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 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.base;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-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.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.testconcepts.DummyPfModel;
 
-public class ModelServiceTest {
+class ModelServiceTest {
 
     private static final String MODEL_KEY_IS_NULL = "modelKey is marked .*on.*ull but is null$";
     private static final String MODEL_NAME = "ModelName";
 
     @Test
-    public void testModelService() {
+    void testModelService() {
         PfModelService.clear();
 
         assertFalse(PfModelService.existsModel("NonExistantName"));
index d69c932..7545c81 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.base;
 
-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.base.testconcepts.DummyPfConcept;
 
-public class PfConceptComparatorTest {
+class PfConceptComparatorTest {
 
     @Test
-    public void testPfConceptComparator() {
+    void testPfConceptComparator() {
         assertEquals(0, new PfConceptComparator().compare(new DummyPfConcept(), new DummyPfConcept()));
     }
 }
index c526b23..22acc8d 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021, 2023 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 2023, 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,11 +23,12 @@ package org.onap.policy.models.base;
 
 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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
@@ -35,14 +36,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.testconcepts.DummyAuthorativeConcept;
 import org.onap.policy.models.base.testconcepts.DummyBadPfConceptContainer;
 import org.onap.policy.models.base.testconcepts.DummyPfConcept;
 import org.onap.policy.models.base.testconcepts.DummyPfConceptContainer;
 import org.onap.policy.models.base.testconcepts.DummyPfConceptSub;
 
-public class PfConceptContainerTest {
+class PfConceptContainerTest {
 
     private static final String NAME0 = "name0";
     private static final String NAME1 = "name1";
@@ -55,7 +56,7 @@ public class PfConceptContainerTest {
 
     @SuppressWarnings({"unchecked", "rawtypes"})
     @Test
-    public void testConceptContainer() {
+    void testConceptContainer() {
         DummyPfConceptContainer container = new DummyPfConceptContainer();
         assertNotNull(container);
 
@@ -81,7 +82,7 @@ public class PfConceptContainerTest {
     }
 
     @Test
-    public void testNamedConceptContainer() {
+    void testNamedConceptContainer() {
         DummyPfConceptContainer container = new DummyPfConceptContainer();
         container.getKey().setName(DUMMY_VALUE);
         DummyPfConceptContainer clonedContainer = new DummyPfConceptContainer(container);
@@ -134,7 +135,7 @@ public class PfConceptContainerTest {
     }
 
     @Test
-    public void testValidationContainer() {
+    void testValidationContainer() {
         DummyPfConceptContainer container = new DummyPfConceptContainer();
         PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0_0_1);
         Map<PfConceptKey, DummyPfConcept> conceptMap = new TreeMap<>();
@@ -171,7 +172,7 @@ public class PfConceptContainerTest {
     }
 
     @Test
-    public void testSetContainer() {
+    void testSetContainer() {
         DummyPfConceptContainer container = new DummyPfConceptContainer();
         PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0_0_1);
         Map<PfConceptKey, DummyPfConcept> conceptMap = new TreeMap<>();
@@ -211,7 +212,7 @@ public class PfConceptContainerTest {
 
 
     @Test
-    public void testAuthorative() {
+    void testAuthorative() {
         Map<String, DummyAuthorativeConcept> dacMap = new LinkedHashMap<>();
         dacMap.put(NAME0, new DummyAuthorativeConcept(NAME0, "1.2.3", "Hello"));
         dacMap.put(NAME1, new DummyAuthorativeConcept("IncorrectName", PfKey.NULL_KEY_VERSION, "Hi"));
@@ -270,9 +271,12 @@ public class PfConceptContainerTest {
             .hasMessage("An incoming list of concepts must have at least one entry");
     }
 
-    @Test(expected = NullPointerException.class)
-    public void testNullKey() {
-        PfConceptKey nullKey = null;
-        new DummyPfConceptContainer(nullKey);
+    @Test
+    void testNullKey() {
+        assertThrows(NullPointerException.class,
+            () -> {
+                PfConceptKey nullKey = null;
+                new DummyPfConceptContainer(nullKey);
+            });
     }
 }
index 6d02b2f..07a97e7 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.base;
 
 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 org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the {@link PfObjectFilter} interface.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfConceptFilterTest {
+class PfConceptFilterTest {
 
     @Test
-    public void testPfConceptFilter() {
+    void testPfConceptFilter() {
         List<PfConcept> listToBeFiltered = new ArrayList<>();
 
         PfConceptFilter conceptFilter = new PfConceptFilter(null, null, null);
index 54b5f3f..c88e350 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. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
 package org.onap.policy.models.base;
 
 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.util.NavigableMap;
 import java.util.TreeMap;
 import java.util.TreeSet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the given concept class.
  */
-public class PfConceptGetterImplTest {
+class PfConceptGetterImplTest {
 
     private static final String VERSION002 = "0.0.2";
     private static final String VERSION001 = "0.0.1";
 
     @Test
-    public void testPfConceptGetterImpl() {
+    void testPfConceptGetterImpl() {
         NavigableMap<PfConceptKey, PfConceptKey> keyMap = new TreeMap<>();
 
         PfConceptGetterImpl<PfConceptKey> getter = new PfConceptGetterImpl<>(keyMap);
index 62d8d2b..277c927 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2024 Nordix Foundation.
  *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,20 +23,20 @@ package org.onap.policy.models.base;
 
 import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
 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.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+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.models.base.testconcepts.DummyPfConcept;
 
-public class PfConceptKeyTest {
+class PfConceptKeyTest {
 
     private static final String VERSION001 = "0.0.1";
     private static final String ID_IS_NULL = "id is marked .*on.*ull but is null$";
 
     @Test
-    public void testConceptKey() {
+    void testConceptKey() {
         PfConceptKey someKey0 = new PfConceptKey();
         assertEquals(PfConceptKey.getNullKey(), someKey0);
         assertTrue(someKey0.isNullKey());
index aefd389..5557c97 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021,2023 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 2023, 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");
@@ -24,24 +24,24 @@ package org.onap.policy.models.base;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
 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.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.assertTrue;
 
 import java.lang.reflect.Field;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.parameters.annotations.Pattern;
 import org.onap.policy.models.base.PfKey.Compatibility;
 import org.onap.policy.models.base.testconcepts.DummyPfKey;
 
-public class PfKeyImplTest {
+class PfKeyImplTest {
 
     private static final String OTHER_IS_NULL = "^otherKey is marked .*on.*ull but is null$";
     private static final String ID_IS_NULL = "^id is marked .*on.*ull but is null$";
@@ -67,7 +67,7 @@ public class PfKeyImplTest {
     /**
      * Sets data in Keys for the tests.
      */
-    @BeforeClass
+    @BeforeAll
     public static void setUp() {
         someKey = new MyKey();
 
@@ -94,7 +94,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testConceptKey() {
+    void testConceptKey() {
         assertThatIllegalArgumentException().isThrownBy(() -> new MyKey("some bad key id"))
             .withMessage("parameter \"id\": value \"some bad key id\", " + "does not match regular expression \""
                 + PfKey.KEY_ID_REGEXP + "\"");
@@ -118,7 +118,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testCompatibilityConceptKey() {
+    void testCompatibilityConceptKey() {
         assertEquals("name:0.1.2", someKey4.getId());
 
         assertThatThrownBy(() -> someKey0.getCompatibility(null)).isInstanceOf(NullPointerException.class)
@@ -150,7 +150,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testValidityConceptKey() {
+    void testValidityConceptKey() {
         assertTrue(someKey0.validate("").isValid());
         assertTrue(someKey1.validate("").isValid());
         assertTrue(someKey2.validate("").isValid());
@@ -165,7 +165,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testCleanConceptKey() {
+    void testCleanConceptKey() {
         someKey0.clean();
         assertNotNull(someKey0.toString());
 
@@ -192,7 +192,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testNullArguments() {
+    void testNullArguments() {
         assertThatThrownBy(() -> new MyKey((String) null)).hasMessageMatching(ID_IS_NULL);
 
         assertThatThrownBy(() -> new MyKey((MyKey) null))
@@ -210,7 +210,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testValidation() throws Exception {
+    void testValidation() throws Exception {
         MyKey testKey = new MyKey("TheKey", VERSION001);
         assertEquals("TheKey:0.0.1", testKey.getId());
 
@@ -234,7 +234,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testkeynewerThan() {
+    void testkeynewerThan() {
         MyKey key1 = new MyKey("Key1", VERSION123);
 
         assertThatThrownBy(() -> key1.isNewerThan(null)).hasMessageMatching(OTHER_IS_NULL);
@@ -290,7 +290,7 @@ public class PfKeyImplTest {
     }
 
     @Test
-    public void testmajorMinorPatch() {
+    void testmajorMinorPatch() {
         MyKey key = new MyKey("Key", VERSION100);
         assertEquals(1, key.getMajorVersion());
         assertEquals(0, key.getMinorVersion());
index 58c872c..c44be74 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 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.base;
 
 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 org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.PfKey.Compatibility;
 import org.onap.policy.models.base.testconcepts.DummyPfConceptKeySub;
 
-public class PfKeyUseTest {
+class PfKeyUseTest {
 
     private static final String OTHER_KEY_IS_NULL = "^otherKey is marked .*on.*ull but is null$";
 
     @Test
-    public void testKeyUse() {
+    void testKeyUse() {
         assertNotNull(new PfKeyUse());
         assertNotNull(new PfKeyUse(new PfConceptKey()));
         assertNotNull(new PfKeyUse(new PfReferenceKey()));
@@ -83,7 +83,7 @@ public class PfKeyUseTest {
     }
 
     @Test
-    public void testNullKey() {
+    void testNullKey() {
         PfKeyUse keyUseNull = new PfKeyUse(PfConceptKey.getNullKey());
         PfKeyUse keyUse = new PfKeyUse();
         assertEquals(false, keyUseNull.validate("").isValid());
index 8b62020..d570099 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020, 2023 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2023, 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.base;
 
 import static org.assertj.core.api.Assertions.assertThat;
-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 jakarta.ws.rs.core.Response;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
 
 /**
@@ -33,10 +33,10 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfModelExceptionInfoTest {
+class PfModelExceptionInfoTest {
 
     @Test
-    public void testExceptionInfo() {
+    void testExceptionInfo() {
         final PfModelException pfme = new PfModelException(Response.Status.ACCEPTED, "HELLO");
         assertThat(pfme).hasMessage("HELLO");
         assertEquals("Server returned: Accepted", getErrorMessage(pfme).substring(0, 25));
index 8f0ca35..2b55a7d 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 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.base;
 
 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 org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.testconcepts.DummyPfModel;
 
 /**
@@ -36,12 +36,12 @@ import org.onap.policy.models.base.testconcepts.DummyPfModel;
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfModelTest {
+class PfModelTest {
 
     private static final String VERSION001 = "0.0.1";
 
     @Test
-    public void testPfModel() {
+    void testPfModel() {
         assertNotNull(new DummyPfModel());
         assertNotNull(new DummyPfModel(new PfConceptKey()));
         assertNotNull(new DummyPfModel(new DummyPfModel()));
@@ -70,7 +70,7 @@ public class PfModelTest {
     }
 
     @Test
-    public void testPfModelValidation() {
+    void testPfModelValidation() {
         PfConceptKey dpmKey = new PfConceptKey("modelKey", VERSION001);
         DummyPfModel dpm = new DummyPfModel(dpmKey);
         assertTrue(dpm.validate("").isValid());
@@ -97,7 +97,7 @@ public class PfModelTest {
     }
 
     @Test
-    public void testPfReferenceValidation() {
+    void testPfReferenceValidation() {
         PfConceptKey dpmKey = new PfConceptKey("modelKey", VERSION001);
         DummyPfModel dpm = new DummyPfModel(dpmKey);
 
index 2937b60..6272404 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-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.
@@ -20,9 +20,9 @@
 
 package org.onap.policy.models.base;
 
-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.base.testconcepts.DummyPfNameVersion;
 
 /**
@@ -30,10 +30,10 @@ import org.onap.policy.models.base.testconcepts.DummyPfNameVersion;
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfNameVersionTest {
+class PfNameVersionTest {
 
     @Test
-    public void testPfNameVersion() {
+    void testPfNameVersion() {
         DummyPfNameVersion dnv0 = new DummyPfNameVersion();
         DummyPfNameVersion dnv1 = new DummyPfNameVersion();
 
index 169d97f..5bd30e9 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 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.base;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-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.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.function.Predicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.testconcepts.DummyPfObject;
 import org.onap.policy.models.base.testconcepts.DummyPfObjectComparator;
 import org.onap.policy.models.base.testconcepts.DummyPfObjectFilter;
@@ -40,7 +40,7 @@ import org.onap.policy.models.base.testconcepts.DummyPfObjectFilter;
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfObjectFilterTest {
+class PfObjectFilterTest {
 
     private static final String NAME1 = "name1";
     private static final String NAME0 = "name0";
@@ -50,7 +50,7 @@ public class PfObjectFilterTest {
     private static final String VERSION002 = "0.0.2";
 
     @Test
-    public void testPfObjectInterface() {
+    void testPfObjectInterface() {
         DummyPfObjectFilter dof = new DummyPfObjectFilter();
         assertFalse(dof.filterString(HELLO, "Goodbye"));
         assertTrue(dof.filterString(HELLO, HELLO));
@@ -77,7 +77,7 @@ public class PfObjectFilterTest {
     }
 
     @Test
-    public void testStringFilteredPfObjectInterface() {
+    void testStringFilteredPfObjectInterface() {
         List<DummyPfObject> doList = getListPfObject();
         MyFilter filter = new MyFilter();
 
@@ -97,7 +97,7 @@ public class PfObjectFilterTest {
     }
 
     @Test
-    public void testPrefixFilteredPfObjectInterface() {
+    void testPrefixFilteredPfObjectInterface() {
 
         DummyPfObject doNullVersion = new DummyPfObject();
         MyFilter filter = new MyFilter();
@@ -117,7 +117,7 @@ public class PfObjectFilterTest {
     }
 
     @Test
-    public void testRegexFilteredPfObjectInterface() {
+    void testRegexFilteredPfObjectInterface() {
         List<DummyPfObject> doList = getListPfObject();
         DummyPfObject do0 = doList.get(0);
 
index ce1c3e8..d605645 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 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.base;
 
 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.lang.reflect.Field;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.common.parameters.ValidationResult;
 
-public class PfReferenceKeyTest {
+class PfReferenceKeyTest {
 
     private static final String PARENT_LOCAL_NAME = "ParentLocalName";
     private static final String NPKLN = "NPKLN";
@@ -42,7 +42,7 @@ public class PfReferenceKeyTest {
     private static final String VERSION001 = "0.0.1";
 
     @Test
-    public void testPfReferenceKeyNotNull() {
+    void testPfReferenceKeyNotNull() {
         assertNotNull(new PfReferenceKey());
         assertNotNull(new PfReferenceKey(new PfConceptKey()));
         assertNotNull(new PfReferenceKey(new PfConceptKey(), LOCAL_NAME));
@@ -60,7 +60,7 @@ public class PfReferenceKeyTest {
     }
 
     @Test
-    public void testPfReferenceKey() {
+    void testPfReferenceKey() {
         PfReferenceKey testReferenceKey = new PfReferenceKey();
         testReferenceKey.setParentConceptKey(new PfConceptKey("PN", VERSION001));
         assertEquals("PN:0.0.1", testReferenceKey.getParentConceptKey().getId());
@@ -102,7 +102,7 @@ public class PfReferenceKeyTest {
     }
 
     @Test
-    public void testMultiplePfReferenceKey() {
+    void testMultiplePfReferenceKey() {
         PfReferenceKey testReferenceKey = setTestReferenceKey();
         testReferenceKey.clean();
 
@@ -138,7 +138,7 @@ public class PfReferenceKeyTest {
     }
 
     @Test
-    public void testValidation() throws Exception {
+    void testValidation() throws Exception {
         PfReferenceKey testReferenceKey = new PfReferenceKey();
         testReferenceKey.setParentConceptKey(new PfConceptKey("PN", VERSION001));
         assertEquals("PN:0.0.1", testReferenceKey.getParentConceptKey().getId());
index 4865eb9..62418d9 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,17 +22,17 @@ package org.onap.policy.models.base;
 
 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.time.Instant;
 import java.util.Date;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class PfReferenceTimestampKeyTest {
+class PfReferenceTimestampKeyTest {
 
     private static final String PARENT_LOCAL_NAME = "ParentLocalName";
     private static final String LOCAL_NAME = "LocalName";
@@ -42,7 +42,7 @@ public class PfReferenceTimestampKeyTest {
     private static final Instant DEFAULT_TIMESTAMP = Instant.EPOCH;
 
     @Test
-    public void testPfReferenceTimestampKeyConstruct() {
+    void testPfReferenceTimestampKeyConstruct() {
         assertThat(new PfReferenceTimestampKey().getReferenceKey().getLocalName()).isEqualTo(PfKey.NULL_KEY_NAME);
         assertEquals(PfKey.NULL_KEY_NAME, new PfReferenceTimestampKey(new PfConceptKey()).getReferenceKey()
             .getParentKeyName());
@@ -76,7 +76,7 @@ public class PfReferenceTimestampKeyTest {
     }
 
     @Test
-    public void testPfReferenceTimestampKey() {
+    void testPfReferenceTimestampKey() {
         PfReferenceTimestampKey testReferenceKey = new PfReferenceTimestampKey();
         testReferenceKey.setReferenceKey(new PfReferenceKey(new PfConceptKey("PN", VERSION001)));
         assertEquals("PN:0.0.1", testReferenceKey.getReferenceKey().getParentConceptKey().getId());
@@ -144,7 +144,7 @@ public class PfReferenceTimestampKeyTest {
     }
 
     @Test
-    public void testNewerKey() {
+    void testNewerKey() {
         PfReferenceTimestampKey key1 = new PfReferenceTimestampKey("ParentKeyName", VERSION001, PARENT_LOCAL_NAME,
                 LOCAL_NAME, Instant.ofEpochSecond(timeStamp));
         PfReferenceTimestampKey key2 = new PfReferenceTimestampKey(key1);
index f4f4bac..5f23318 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2024 Nordix Foundation.
  *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,20 +23,20 @@ package org.onap.policy.models.base;
 
 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.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+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.models.base.testconcepts.DummyPfConcept;
 
-public class PfSearchableKeyTest {
+class PfSearchableKeyTest {
 
     private static final String VERSION001 = "0.0.1";
     private static final String ID_IS_NULL = "^id is marked .*on.*ull but is null$";
 
     @Test
-    public void testSearchableKey() {
+    void testSearchableKey() {
         PfSearchableKey someKey0 = new PfSearchableKey();
         assertEquals(PfSearchableKey.getNullKey(), someKey0);
         assertTrue(someKey0.isNullKey());
index 79f271c..90eacca 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2021, 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.base;
 
 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.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.time.Instant;
 import java.util.Date;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class PfTimestampKeyTest {
+class PfTimestampKeyTest {
     private static final String VERSION001 = "0.0.1";
     private static final String CONCEPT_IS_NULL = "^copyConcept is marked .*on.*ull but is null$";
     private static final String NAME_IS_NULL = "^name is marked .*on.*ull but is null$";
@@ -38,7 +38,7 @@ public class PfTimestampKeyTest {
     private static final long timeStamp = 1574832537641L;
 
     @Test
-    public void testTimestampKey() {
+    void testTimestampKey() {
         PfTimestampKey someKey0 = new PfTimestampKey();
         assertEquals(PfTimestampKey.getNullKey(), someKey0);
         assertTrue(someKey0.isNullKey());
@@ -85,7 +85,7 @@ public class PfTimestampKeyTest {
     }
 
     @Test
-    public void testTimestampKeyErrors() {
+    void testTimestampKeyErrors() {
         assertThatThrownBy(() -> new PfTimestampKey((PfTimestampKey) null)).isInstanceOf(NullPointerException.class)
                 .hasMessageMatching(CONCEPT_IS_NULL);
         assertThatThrownBy(() -> new PfTimestampKey(null, null, null)).isInstanceOf(NullPointerException.class)
index d96d224..2fea439 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2024 Nordix Foundation.
  *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,9 +22,9 @@
 package org.onap.policy.models.base;
 
 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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.util.Arrays;
 import java.util.List;
@@ -32,19 +32,19 @@ import java.util.Map;
 import java.util.TreeMap;
 import lombok.Getter;
 import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the PfUtils class.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class PfUtilsTest {
+class PfUtilsTest {
 
     private static final String HELLO = "hello";
 
     @Test
-    public void testCompareObjects() {
+    void testCompareObjects() {
         assertEquals(0, PfUtils.compareObjects(null, null));
         assertEquals(-1, PfUtils.compareObjects(HELLO, null));
         assertEquals(1, PfUtils.compareObjects(null, HELLO));
@@ -53,7 +53,7 @@ public class PfUtilsTest {
     }
 
     @Test
-    public void testMapList() {
+    void testMapList() {
         List<Object> resultList = PfUtils.mapList(null, item -> {
             throw new RuntimeException("should not be invoked");
         });
@@ -70,7 +70,7 @@ public class PfUtilsTest {
     }
 
     @Test
-    public void testMapMap() {
+    void testMapMap() {
         Map<String, String> resultMap = PfUtils.mapMap(null, item -> {
             throw new RuntimeException("should not be invoked");
         });
@@ -89,7 +89,7 @@ public class PfUtilsTest {
     }
 
     @Test
-    public void testMakeCopy() {
+    void testMakeCopy() {
         assertNull(PfUtils.makeCopy((MyObject) null));
         NoCopyConstructor noCopyConstructor = new NoCopyConstructor();
         MyObject origObject = new MyObject();
index ed8c138..3787aef 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023, 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.
@@ -30,8 +30,8 @@ import java.io.Serial;
 import java.util.concurrent.atomic.AtomicBoolean;
 import lombok.Getter;
 import lombok.NonNull;
-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.common.parameters.annotations.NotNull;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -39,20 +39,20 @@ import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.models.base.validation.annotations.PfMin;
 import org.onap.policy.models.base.validation.annotations.VerifyKey;
 
-public class PfValidatorTest {
+class PfValidatorTest {
     private static final String KEY_FIELD = "key";
 
     private static final String STRING_VALUE = "abc";
 
     private PfValidator validator;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         validator = new PfValidator();
     }
 
     @Test
-    public void testAddValidatorsValueValidator() {
+    void testAddValidatorsValueValidator() {
         // verify that standard annotations work
         StdAnnotation data = new StdAnnotation();
         data.strValue = STRING_VALUE;
@@ -63,7 +63,7 @@ public class PfValidatorTest {
     }
 
     @Test
-    public void testVerPfMin() {
+    void testVerPfMin() {
         PfMinChecker data = new PfMinChecker();
         data.intValue = 10;
         assertThat(validator.validateTop("", data).getResult()).isNull();
@@ -82,7 +82,7 @@ public class PfValidatorTest {
     }
 
     @Test
-    public void testVerCascadeBeanValidationResultStringObject() {
+    void testVerCascadeBeanValidationResultStringObject() {
         CascadeChecker checker = new CascadeChecker();
         checker.plain = new StdAnnotation();
 
@@ -115,7 +115,7 @@ public class PfValidatorTest {
     }
 
     @Test
-    public void testVerKey() throws CoderException {
+    void testVerKey() throws CoderException {
         FullKeyAnnot data = new FullKeyAnnot();
 
         // not a key
@@ -183,7 +183,7 @@ public class PfValidatorTest {
     }
 
     @Test
-    public void testXlateObject() {
+    void testXlateObject() {
         assertThat(validator.xlate(null)).isNull();
         assertThat(validator.xlate("hello")).isEqualTo("hello");
 
index 98dfe89..6d12614 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2020-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,19 +24,19 @@ package org.onap.policy.models.base;
 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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import lombok.AllArgsConstructor;
 import lombok.NonNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.parameters.ValidationStatus;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
 
-public class ValidatedTest {
+class ValidatedTest {
     private static final @NonNull String MY_FIELD = "myField";
     private static final @NonNull String Q_KEY = "\"" + Validated.KEY_TOKEN + "\"";
     private static final @NonNull String Q_VALUE = "\"" + Validated.VALUE_TOKEN + "\"";
@@ -46,7 +47,7 @@ public class ValidatedTest {
     private static final String VERSION = "1.0.0";
 
     @Test
-    public void testAddResult() {
+    void testAddResult() {
         BeanValidationResult result = new BeanValidationResult("", this);
         Validated.addResult(result, MY_FIELD, TEXT, "some message");
         assertThat(result.getResult()).contains(MY_FIELD).contains(TEXT).contains("some message");
@@ -64,7 +65,7 @@ public class ValidatedTest {
     }
 
     @Test
-    public void testMakeNullResult() {
+    void testMakeNullResult() {
         ValidationResult rnull = Validated.makeNullResult(MY_FIELD, TEXT);
         assertEquals(MY_FIELD, rnull.getName());
         assertThat(rnull.getResult()).contains(MY_FIELD).contains(TEXT).contains(Validated.IS_NULL);
@@ -76,7 +77,7 @@ public class ValidatedTest {
     }
 
     @Test
-    public void testValidateKeyNotNull() throws CoderException {
+    void testValidateKeyNotNull() throws CoderException {
         BeanValidationResult result = new BeanValidationResult("", this);
         Validated.validateKeyNotNull(result, MY_FIELD, new PfConceptKey(NAME, VERSION));
         assertThat(result.getResult()).isNull();
@@ -117,7 +118,7 @@ public class ValidatedTest {
     }
 
     @Test
-    public void testValidateKeyVersionNotNull() {
+    void testValidateKeyVersionNotNull() {
         BeanValidationResult result = new BeanValidationResult("", this);
         Validated.validateKeyVersionNotNull(result, MY_FIELD, null);
         assertThat(result.getResult()).isNull();
@@ -139,7 +140,7 @@ public class ValidatedTest {
     }
 
     @Test
-    public void testGetKeyId() {
+    void testGetKeyId() {
         // not a key field - should just use the given value
         BeanValidationResult result = new BeanValidationResult("", this);
         Validated.addResult(result, MY_FIELD, TEXT, "some message");
index 3a46570..0923f34 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 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");
 package org.onap.policy.models.dao;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.util.Properties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.dao.converters.CDataConditioner;
 import org.onap.policy.models.dao.converters.Uuid2String;
 
-public class DaoMiscTest {
+class DaoMiscTest {
 
     private static final String SOMEWHERE_OVER_THE_RAINBOW = "somewhere.over.the.rainbow";
 
     @Test
-    public void testUuid2StringMopUp() {
+    void testUuid2StringMopUp() {
         final Uuid2String uuid2String = new Uuid2String();
         assertEquals("", uuid2String.convertToDatabaseColumn(null));
     }
 
     @Test
-    public void testCDataConditionerMopUp() {
+    void testCDataConditionerMopUp() {
         assertNull(CDataConditioner.clean(null));
     }
 
     @Test
-    public void testDaoFactory() {
+    void testDaoFactory() {
         final DaoParameters daoParameters = new DaoParameters();
 
         daoParameters.setPluginClass(SOMEWHERE_OVER_THE_RAINBOW);
@@ -59,7 +59,7 @@ public class DaoMiscTest {
     }
 
     @Test
-    public void testDaoParameters() {
+    void testDaoParameters() {
         final DaoParameters pars = new DaoParameters();
         pars.setJdbcProperties(new Properties());
         assertEquals(0, pars.getJdbcProperties().size());
index 4f281bd..fb2155c 100644 (file)
@@ -25,9 +25,9 @@ package org.onap.policy.models.dao;
 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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.time.Instant;
 import java.util.ArrayList;
@@ -38,8 +38,8 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.UUID;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.base.PfReferenceKey;
@@ -50,7 +50,7 @@ import org.onap.policy.models.dao.impl.DefaultPfDao;
 /**
  * JUnit test class.
  */
-public class EntityTest {
+class EntityTest {
     private static final String DESCRIPTION2 = "key description 2";
     private static final String DESCRIPTION1 = "key description 1";
     private static final String DESCRIPTION0 = "key description 0";
@@ -65,13 +65,13 @@ public class EntityTest {
     private static final Instant TIMESTAMP1 = Instant.ofEpochSecond(1613494293).plusSeconds(55);
     private static final Instant TIMESTAMP2 = Instant.ofEpochSecond(1613494293).plusSeconds(90);
 
-    private PfDao pfDao;
+    private static PfDao pfDao;
 
     /**
      * Closes the DAO.
      */
-    @After
-    public void tearDown() {
+    @AfterAll
+    public static void tearDown() {
         if (pfDao != null) {
             pfDao.close();
             pfDao = null;
@@ -79,7 +79,7 @@ public class EntityTest {
     }
 
     @Test
-    public void testEntityTestSanity() throws PfModelException {
+    void testEntityTestSanity() throws PfModelException {
         final DaoParameters daoParameters = new DaoParameters();
 
         Properties jdbcProperties = new Properties();
@@ -110,7 +110,7 @@ public class EntityTest {
     }
 
     @Test
-    public void testEntityTestAllOpsJpa() throws PfModelException {
+    void testEntityTestAllOpsJpa() throws PfModelException {
 
         final DaoParameters daoParameters = new DaoParameters();
         daoParameters.setPluginClass(DefaultPfDao.class.getName());
@@ -139,7 +139,7 @@ public class EntityTest {
     }
 
     @Test
-    public void testEntityTestBadVals() throws PfModelException {
+    void testEntityTestBadVals() throws PfModelException {
         final DaoParameters daoParameters = new DaoParameters();
         daoParameters.setPluginClass(DefaultPfDao.class.getName());
         daoParameters.setPersistenceUnit("DaoTest");
index 60a42c2..6848c7d 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.
 
 package org.onap.policy.models.dao.converters;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the CDataConditioner Class.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class CDataConditionerTest {
+class CDataConditionerTest {
 
     @Test
-    public void testCDataConditioner() throws Exception {
+    void testCDataConditioner() throws Exception {
         assertEquals("Raw", new CDataConditioner().convertToDatabaseColumn("Raw"));
         assertEquals("entityAttribute", new CDataConditioner().convertToEntityAttribute("entityAttribute"));
         assertEquals("marshal", new CDataConditioner().marshal("marshal"));
index c490fdb..1f36943 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.
 
 package org.onap.policy.models.dao.converters;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.UUID;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the UUID conditioner class.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class Uuid2StringConditionerTest {
+class Uuid2StringConditionerTest {
 
     @Test
-    public void testUuidConditioner() throws Exception {
+    void testUuidConditioner() throws Exception {
         UUID randomUuid = UUID.randomUUID();
         assertEquals(randomUuid.toString(), new Uuid2String().convertToDatabaseColumn(randomUuid));
         assertEquals(randomUuid, new Uuid2String().convertToEntityAttribute(randomUuid.toString()));
index 5ae9fd9..29ca721 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP Policy Decision 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.
@@ -25,13 +26,13 @@ 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;
 
-public class TestModels {
+class TestModels {
 
     @Test
-    public void testDecisionModels() {
+    void testDecisionModels() {
         final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterTester())
                 .with(new GetterTester()).build();
         validator.validate(TestModels.class.getPackage().getName(), new FilterPackageInfo());
index 0be37f4..3ede12a 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Decision Models
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023, 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.errors.concepts;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import jakarta.ws.rs.core.Response;
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ErrorResponseTest {
+class ErrorResponseTest {
 
-    public static final Logger logger = LoggerFactory.getLogger(ErrorResponseTest.class);
+    static final Logger logger = LoggerFactory.getLogger(ErrorResponseTest.class);
 
     @Test
-    public void test() {
+    void test() {
         assertThatCode(() -> {
             ErrorResponse error = new ErrorResponse();
 
index c19b18b..317c42c 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 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.errors.concepts;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test the {@link ErrorResponseUtils} class.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
-public class ErrorResponseUtilsTest {
+class ErrorResponseUtilsTest {
     private static final String EXCEPTION1 = "Exception 1";
 
     @Test
-    public void testErrorResponseUtils() {
+    void testErrorResponseUtils() {
         final IOException ioe = new IOException(EXCEPTION1, new NumberFormatException("Exception 0"));
         final ErrorResponse errorResponse = new ErrorResponse();
         assertThat(ioe).hasMessage(EXCEPTION1);
index 054aaa5..4914cc6 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP Policy Decision 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.
@@ -25,13 +26,13 @@ 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;
 
-public class TestModels {
+class TestModels {
 
     @Test
-    public void testDecisionModels() {
+    void testDecisionModels() {
         final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterTester())
                 .with(new GetterTester()).build();
         validator.validate(TestModels.class.getPackage().getName(), new FilterPackageInfo());