diff options
Diffstat (limited to 'models-sim/policy-models-sim-pdp')
9 files changed, 103 insertions, 94 deletions
diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorActivator.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorActivator.java index 1ebd2a082..1d58a3325 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorActivator.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorActivator.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications 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. @@ -22,15 +23,15 @@ package org.onap.policy.models.sim.pdp; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.sim.pdp.exception.PdpSimulatorException; @@ -43,7 +44,7 @@ import org.onap.policy.models.sim.pdp.parameters.PdpSimulatorParameterHandler; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpSimulatorActivator { +class TestPdpSimulatorActivator { private PdpSimulatorActivator activator; @@ -52,8 +53,8 @@ public class TestPdpSimulatorActivator { * * @throws Exception if an error occurs */ - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { Registry.newRegistry(); final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json" }; final PdpSimulatorCommandLineArguments arguments = @@ -68,15 +69,15 @@ public class TestPdpSimulatorActivator { * * @throws Exception if an error occurs */ - @After - public void teardown() throws Exception { + @AfterEach + void teardown() throws Exception { if (activator != null && activator.isAlive()) { activator.terminate(); } } @Test - public void testPdpSimulatorActivator() throws PdpSimulatorException { + void testPdpSimulatorActivator() throws PdpSimulatorException { assertFalse(activator.isAlive()); activator.initialize(); assertTrue(activator.isAlive()); @@ -93,7 +94,7 @@ public class TestPdpSimulatorActivator { } @Test - public void testTerminate() throws Exception { + void testTerminate() throws Exception { activator.initialize(); activator.terminate(); assertFalse(activator.isAlive()); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java index 10d7d9f68..ca6562368 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019,2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,16 +25,16 @@ package org.onap.policy.models.sim.pdp; import static org.assertj.core.api.Assertions.assertThatCode; import java.lang.reflect.Constructor; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Class to perform unit test of {@link PdpSimulatorConstants}}. * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpSimulatorConstants { +class TestPdpSimulatorConstants { @Test - public void test() throws Exception { + void test() throws Exception { // verify that constructor does not throw an exception assertThatCode(() -> { Constructor<PdpSimulatorConstants> c = PdpSimulatorConstants.class.getDeclaredConstructor(); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java index 0f82e6608..e02f5997c 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,14 +23,14 @@ package org.onap.policy.models.sim.pdp; import static org.assertj.core.api.Assertions.assertThatCode; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.sim.pdp.exception.PdpSimulatorException; import org.onap.policy.models.sim.pdp.parameters.CommonTestData; @@ -39,14 +40,14 @@ import org.onap.policy.models.sim.pdp.parameters.CommonTestData; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpSimulatorMain { +class TestPdpSimulatorMain { private PdpSimulatorMain pdpSimulator; /** * Set up. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { Registry.newRegistry(); } @@ -55,8 +56,8 @@ public class TestPdpSimulatorMain { * * @throws Exception if an error occurs */ - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { // shut down activator final PdpSimulatorActivator activator = Registry.getOrDefault(PdpSimulatorConstants.REG_PDP_SIMULATOR_ACTIVATOR, PdpSimulatorActivator.class, null); @@ -66,7 +67,7 @@ public class TestPdpSimulatorMain { } @Test - public void testPdpSimulator() throws PdpSimulatorException { + void testPdpSimulator() throws PdpSimulatorException { final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json" }; pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters); assertTrue(pdpSimulator.getParameters().isValid()); @@ -79,27 +80,27 @@ public class TestPdpSimulatorMain { } @Test - public void testPdpSimulator_NoArguments() { + void testPdpSimulator_NoArguments() { final String[] pdpSimulatorConfigParameters = {}; pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters); assertNull(pdpSimulator.getParameters()); } @Test - public void testPdpSimulator_InvalidArguments() { + void testPdpSimulator_InvalidArguments() { final String[] pdpSimulatorConfigParameters = { "src/test/resourcesPdpSimulatorConfigParameters.json" }; pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters); assertNull(pdpSimulator.getParameters()); } @Test - public void testPdpSimulator_Help() { + void testPdpSimulator_Help() { final String[] pdpSimulatorConfigParameters = { "-h" }; assertThatCode(() -> PdpSimulatorMain.main(pdpSimulatorConfigParameters)).doesNotThrowAnyException(); } @Test - public void testPdpSimulator_InvalidParameters() { + void testPdpSimulator_InvalidParameters() { final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters_InvalidName.json" }; pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java index 20c9cc1b0..c0e933fb1 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ package org.onap.policy.models.sim.pdp.comm; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -31,9 +32,9 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpStateChange; @@ -52,7 +53,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpStateChangeListener { +class TestPdpStateChangeListener { private static final String PDP_SUBGROUP = "pdpSubgroup"; private static final String PDP_GROUP = "pdpGroup"; private PdpUpdateListener pdpUpdateMessageListener; @@ -66,8 +67,8 @@ public class TestPdpStateChangeListener { * * @throws Exception if an error occurs */ - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { pdpUpdateMessageListener = new PdpUpdateListener(); pdpStateChangeListener = new PdpStateChangeListener(); Registry.newRegistry(); @@ -96,8 +97,8 @@ public class TestPdpStateChangeListener { * * @throws Exception if an error occurs */ - @After - public void teardown() throws Exception { + @AfterEach + void teardown() throws Exception { // clear the pdp simulator activator if (activator != null && activator.isAlive()) { @@ -139,7 +140,7 @@ public class TestPdpStateChangeListener { } @Test - public void testPdpStateChangeMessageListener_passivetopassive() { + void testPdpStateChangeMessageListener_passivetopassive() { final PdpStatus pdpStatus = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT); performPdpUpdate(pdpStatus.getName()); final PdpStateChange pdpStateChangeMsg = new PdpStateChange(); @@ -149,11 +150,11 @@ public class TestPdpStateChangeListener { pdpStateChangeMsg.setName(pdpStatus.getName()); pdpStateChangeListener.onTopicEvent(INFRA, TOPIC, null, pdpStateChangeMsg); - assertEquals(pdpStatus.getState(), pdpStateChangeMsg.getState()); + assertEquals(pdpStateChangeMsg.getState(), pdpStatus.getState()); } @Test - public void testPdpStateChangeMessageListener_activetoactive() { + void testPdpStateChangeMessageListener_activetoactive() { final PdpStatus pdpStatus = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT); performPdpUpdate(pdpStatus.getName()); pdpStatus.setState(PdpState.ACTIVE); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java index 0827f2619..b63fd1546 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ package org.onap.policy.models.sim.pdp.comm; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -31,9 +32,9 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpStatus; @@ -51,7 +52,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpUpdateListener { +class TestPdpUpdateListener { private PdpUpdateListener pdpUpdateMessageListener; private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; @@ -62,8 +63,8 @@ public class TestPdpUpdateListener { * * @throws Exception if an error occurs */ - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { Registry.newRegistry(); final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); @@ -91,8 +92,8 @@ public class TestPdpUpdateListener { * * @throws Exception if an error occurs */ - @After - public void teardown() throws Exception { + @AfterEach + void teardown() throws Exception { // clear the pdp simulator activator if (activator != null && activator.isAlive()) { @@ -101,7 +102,7 @@ public class TestPdpUpdateListener { } @Test - public void testPdpUpdateMssageListener() { + void testPdpUpdateMssageListener() { final PdpStatus pdpStatus = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT); final PdpUpdate pdpUpdateMsg = new PdpUpdate(); pdpUpdateMsg.setDescription("dummy pdp status for test"); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/exception/TestExceptions.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/exception/TestExceptions.java index 45845a941..ab5ae89c7 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/exception/TestExceptions.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/exception/TestExceptions.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ package org.onap.policy.models.sim.pdp.exception; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.test.ExceptionsTester; /** @@ -28,10 +29,10 @@ import org.onap.policy.common.utils.test.ExceptionsTester; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestExceptions { +class TestExceptions { @Test - public void test() { + void test() { new ExceptionsTester().test(PdpSimulatorException.class); new ExceptionsTester().test(PdpSimulatorRunTimeException.class); } diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java index b7d13ef79..2b5eed45f 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +23,12 @@ package org.onap.policy.models.sim.pdp.parameters; import static org.assertj.core.api.Assertions.assertThat; -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.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.parameters.ValidationResult; @@ -36,17 +37,17 @@ import org.onap.policy.common.parameters.ValidationResult; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpSimulatorParameterGroup { +class TestPdpSimulatorParameterGroup { CommonTestData commonTestData = new CommonTestData(); @Test - public void testPdpSimulatorParameterGroup_Named() { + void testPdpSimulatorParameterGroup_Named() { final PdpSimulatorParameterGroup pdpSimulatorParameters = new PdpSimulatorParameterGroup("my-name"); assertEquals("my-name", pdpSimulatorParameters.getName()); } @Test - public void testPdpSimulatorParameterGroup() { + void testPdpSimulatorParameterGroup() { final PdpSimulatorParameterGroup pdpSimulatorParameters = commonTestData.toObject( commonTestData.getPdpSimulatorParameterGroupMap(CommonTestData.PDP_SIMULATOR_GROUP_NAME), PdpSimulatorParameterGroup.class); @@ -64,7 +65,7 @@ public class TestPdpSimulatorParameterGroup { } @Test - public void testPdpSimulatorParameterGroup_NullName() { + void testPdpSimulatorParameterGroup_NullName() { final PdpSimulatorParameterGroup pdpSimulatorParameters = commonTestData .toObject(commonTestData.getPdpSimulatorParameterGroupMap(null), PdpSimulatorParameterGroup.class); final ValidationResult validationResult = pdpSimulatorParameters.validate(); @@ -74,7 +75,7 @@ public class TestPdpSimulatorParameterGroup { } @Test - public void testPdpSimulatorParameterGroup_EmptyName() { + void testPdpSimulatorParameterGroup_EmptyName() { final PdpSimulatorParameterGroup pdpSimulatorParameters = commonTestData .toObject(commonTestData.getPdpSimulatorParameterGroupMap(""), PdpSimulatorParameterGroup.class); final ValidationResult validationResult = pdpSimulatorParameters.validate(); @@ -85,7 +86,7 @@ public class TestPdpSimulatorParameterGroup { } @Test - public void testPdpSimulatorParameterGroup_SetName() { + void testPdpSimulatorParameterGroup_SetName() { final PdpSimulatorParameterGroup pdpSimulatorParameters = commonTestData.toObject( commonTestData.getPdpSimulatorParameterGroupMap(CommonTestData.PDP_SIMULATOR_GROUP_NAME), PdpSimulatorParameterGroup.class); @@ -96,7 +97,7 @@ public class TestPdpSimulatorParameterGroup { } @Test - public void testPdpSimulatorParameterGroup_EmptyPdpStatusParameters() { + void testPdpSimulatorParameterGroup_EmptyPdpStatusParameters() { final Map<String, Object> map = commonTestData.getPdpSimulatorParameterGroupMap(CommonTestData.PDP_SIMULATOR_GROUP_NAME); map.put("pdpStatusParameters", commonTestData.getPdpStatusParametersMap(true)); @@ -109,7 +110,7 @@ public class TestPdpSimulatorParameterGroup { } @Test - public void testApexStarterParameterGroupp_EmptyTopicParameters() { + void testApexStarterParameterGroupp_EmptyTopicParameters() { final Map<String, Object> map = commonTestData.getPdpSimulatorParameterGroupMap(CommonTestData.PDP_SIMULATOR_GROUP_NAME); map.put("topicParameterGroup", commonTestData.getTopicParametersMap(true)); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterHandler.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterHandler.java index 84c7b0d5f..41d5e8662 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterHandler.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterHandler.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019-2021, 2024 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +23,12 @@ package org.onap.policy.models.sim.pdp.parameters; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.FileNotFoundException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.cmd.CommandLineException; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.models.sim.pdp.PdpSimulatorCommandLineArguments; @@ -38,10 +39,10 @@ import org.onap.policy.models.sim.pdp.exception.PdpSimulatorException; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpSimulatorParameterHandler { +class TestPdpSimulatorParameterHandler { @Test - public void testParameterHandlerNoParameterFile() throws CommandLineException { + void testParameterHandlerNoParameterFile() throws CommandLineException { final String[] emptyArgumentString = { "-c", "src/test/resources/NoParametersFile.json" }; final PdpSimulatorCommandLineArguments emptyArguments = new PdpSimulatorCommandLineArguments(); @@ -57,7 +58,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testParameterHandlerEmptyParameters() throws CommandLineException { + void testParameterHandlerEmptyParameters() throws CommandLineException { final String[] noArgumentString = { "-c", "src/test/resources/NoParameters.json" }; final PdpSimulatorCommandLineArguments noArguments = new PdpSimulatorCommandLineArguments(); @@ -68,7 +69,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testParameterHandlerInvalidParameters() throws CommandLineException { + void testParameterHandlerInvalidParameters() throws CommandLineException { final String[] invalidArgumentString = { "-c", "src/test/resources/InvalidParameters.json" }; final PdpSimulatorCommandLineArguments invalidArguments = new PdpSimulatorCommandLineArguments(); @@ -80,7 +81,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testParameterHandlerNoParameters() throws CommandLineException { + void testParameterHandlerNoParameters() throws CommandLineException { final String[] noArgumentString = { "-c", "src/test/resources/EmptyConfigParameters.json" }; final PdpSimulatorCommandLineArguments noArguments = new PdpSimulatorCommandLineArguments(); @@ -91,7 +92,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorParameterGroup() throws PdpSimulatorException, CommandLineException { + void testPdpSimulatorParameterGroup() throws PdpSimulatorException, CommandLineException { final String[] pdpSimulatorConfigParameters = { "-c", "src/test/resources/PdpSimulatorConfigParameters.json" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); @@ -103,7 +104,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorParameterGroup_InvalidName() throws CommandLineException { + void testPdpSimulatorParameterGroup_InvalidName() throws CommandLineException { final String[] pdpSimulatorConfigParameters = {"-c", "src/test/resources/PdpSimulatorConfigParameters_InvalidName.json"}; @@ -115,7 +116,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorVersion() throws CommandLineException { + void testPdpSimulatorVersion() throws CommandLineException { final String[] pdpSimulatorConfigParameters = { "-v" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); final String version = arguments.parse(pdpSimulatorConfigParameters); @@ -123,7 +124,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorHelp() throws CommandLineException { + void testPdpSimulatorHelp() throws CommandLineException { final String[] pdpSimulatorConfigParameters = { "-h" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); final String help = arguments.parse(pdpSimulatorConfigParameters); @@ -131,7 +132,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorInvalidOption() { + void testPdpSimulatorInvalidOption() { final String[] pdpSimulatorConfigParameters = { "-d" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); @@ -140,7 +141,7 @@ public class TestPdpSimulatorParameterHandler { } @Test - public void testPdpSimulatorProperty() throws CommandLineException { + void testPdpSimulatorProperty() throws CommandLineException { final String[] pdpSimulatorConfigParameters = { "-p", "dummyProperties.json" }; final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments(); arguments.parse(pdpSimulatorConfigParameters); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpStatusParameters.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpStatusParameters.java index 09ad29547..5adbec109 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpStatusParameters.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpStatusParameters.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,11 +22,11 @@ package org.onap.policy.models.sim.pdp.parameters; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.common.parameters.ValidationResult; /** @@ -33,11 +34,11 @@ import org.onap.policy.common.parameters.ValidationResult; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class TestPdpStatusParameters { +class TestPdpStatusParameters { private static CommonTestData testData = new CommonTestData(); @Test - public void test() { + void test() { final PdpStatusParameters pdpStatusParameters = testData.toObject(testData.getPdpStatusParametersMap(false), PdpStatusParameters.class); final ValidationResult validationResult = pdpStatusParameters.validate(); @@ -50,7 +51,7 @@ public class TestPdpStatusParameters { } @Test - public void testValidate() { + void testValidate() { final PdpStatusParameters pdpStatusParameters = testData.toObject(testData.getPdpStatusParametersMap(false), PdpStatusParameters.class); final ValidationResult result = pdpStatusParameters.validate(); |