diff options
28 files changed, 237 insertions, 230 deletions
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java index b92aed487..20c2ae3f6 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java @@ -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"); @@ -21,22 +21,22 @@ 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())); diff --git a/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java index 60ae85dd8..b4461e8fd 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java @@ -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"); @@ -22,20 +22,20 @@ 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")); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java index d69c93285..7545c8164 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,15 +20,15 @@ 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())); } } diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java index c526b231a..22acc8d9b 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java @@ -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); + }); } } diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java index 6d02b2fdd..07a97e7ff 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,22 +21,22 @@ 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); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java index 54b5f3f9b..c88e35036 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,25 +22,25 @@ 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); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java index 62d8d2bb3..277c927ac 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java @@ -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()); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java index aefd389ac..5557c976e 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java @@ -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()); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java index 58c872c90..c44be74a8 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java @@ -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"); @@ -22,22 +22,22 @@ 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()); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java index 8b6202042..d57009926 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java @@ -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. @@ -21,11 +21,11 @@ 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)); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java index 8f0ca35ad..2b55a7d1f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java @@ -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"); @@ -22,13 +22,13 @@ 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); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java index 2937b60ab..6272404d7 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java @@ -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(); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java index 169d97f84..5bd30e955 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java @@ -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"); @@ -21,16 +21,16 @@ 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); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java index ce1c3e888..d605645ad 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java @@ -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()); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java index 4865eb904..62418d9ef 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,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); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java index f4f4bacb7..5f233184f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java @@ -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()); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java index 79f271c9c..90eacca0d 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java @@ -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"); @@ -22,15 +22,15 @@ 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) diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java index d96d2243f..2fea439b6 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java @@ -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(); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java index ed8c138be..3787aef7f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java @@ -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"); diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java index 98dfe8919..6d126145e 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java @@ -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"); diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java index 3a46570a4..0923f348c 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/DaoMiscTest.java @@ -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"); @@ -22,31 +22,31 @@ 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()); diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java index 4f281bd68..fb2155cfd 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/EntityTest.java @@ -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"); diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java index 60a42c299..6848c7dc3 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,19 +20,19 @@ 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")); diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java index c490fdb3b..1f3694307 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,20 +20,20 @@ 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())); diff --git a/models-decisions/src/test/java/org/onap/policy/models/decisions/concepts/TestModels.java b/models-decisions/src/test/java/org/onap/policy/models/decisions/concepts/TestModels.java index 5ae9fd965..29ca7218c 100644 --- a/models-decisions/src/test/java/org/onap/policy/models/decisions/concepts/TestModels.java +++ b/models-decisions/src/test/java/org/onap/policy/models/decisions/concepts/TestModels.java @@ -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()); diff --git a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java index 0be37f489..3ede12a2e 100644 --- a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java +++ b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java @@ -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. @@ -22,21 +22,21 @@ 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(); diff --git a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseUtilsTest.java b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseUtilsTest.java index c19b18b63..317c42c93 100644 --- a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseUtilsTest.java +++ b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseUtilsTest.java @@ -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"); @@ -22,21 +22,21 @@ 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); diff --git a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/TestModels.java b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/TestModels.java index 054aaa520..4914cc65f 100644 --- a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/TestModels.java +++ b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/TestModels.java @@ -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()); |