diff options
author | 2024-06-17 15:31:12 +0100 | |
---|---|---|
committer | 2024-06-17 16:05:42 +0100 | |
commit | fe6bb57982677177f85daa5f893868556b18e63c (patch) | |
tree | 54a2f6f5a3e31469c4ea703a777399fb30fc9cfc /plugins/plugins-executor/plugins-executor-mvel/src/test/java | |
parent | e9b746340711ddfccee7ac0f669ace626b1b3d46 (diff) |
Convert junit4 to junit5
- plugins module
Issue-ID: POLICY-5041
Change-Id: Iebff0a2e6898a5dfe9679662dd2be4c5067a4008
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-mvel/src/test/java')
4 files changed, 51 insertions, 50 deletions
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelExecutorParametersTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelExecutorParametersTest.java index 81dc037ae..2d3f51fb1 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelExecutorParametersTest.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelExecutorParametersTest.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,17 +20,21 @@ package org.onap.policy.apex.plugins.executor.mvel; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Test the MvelExecutorParameters class. */ -public class MvelExecutorParametersTest { +class MvelExecutorParametersTest { @Test - public void testJavaExecutorParameters() { - assertNotNull(new MvelExecutorParameters()); + void testMvelExecutorParameters() { + var executorType = "Mvel"; + var mvelExecutor = new MvelExecutorParameters(); + assertTrue(mvelExecutor.getStateFinalizerExecutorPluginClass().contains(executorType)); + assertTrue(mvelExecutor.getTaskExecutorPluginClass().contains(executorType)); + assertTrue(mvelExecutor.getTaskSelectionExecutorPluginClass().contains(executorType)); } } diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java index 4dd400bbc..fbd789d96 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java @@ -1,7 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 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. @@ -22,13 +21,13 @@ package org.onap.policy.apex.plugins.executor.mvel; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.Properties; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.DistributorParameters; @@ -52,12 +51,12 @@ import org.onap.policy.common.parameters.ParameterService; * Test the MvelStateFinalizerExecutor class. * */ -public class MvelStateFinalizerExecutorTest { +class MvelStateFinalizerExecutorTest { /** * Initiate Parameters. */ - @Before - public void initiateParameters() { + @BeforeEach + void initiateParameters() { ParameterService.register(new DistributorParameters()); ParameterService.register(new LockManagerParameters()); ParameterService.register(new PersistorParameters()); @@ -67,8 +66,8 @@ public class MvelStateFinalizerExecutorTest { /** * Clear down Parameters. */ - @After - public void clearParameters() { + @AfterEach + void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.LOCKING_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.PERSISTENCE_GROUP_NAME); @@ -76,22 +75,22 @@ public class MvelStateFinalizerExecutorTest { } @Test - public void testJavaStateFinalizerExecutor() throws StateMachineException, ContextException { + void testJavaStateFinalizerExecutor() throws StateMachineException, ContextException { MvelStateFinalizerExecutor msfe = new MvelStateFinalizerExecutor(); assertNotNull(msfe); assertThatThrownBy(msfe::prepare).isInstanceOf(java.lang.NullPointerException.class); - ApexInternalContext internalContext = null; + ApexInternalContext internalContext; internalContext = new ApexInternalContext(new AxPolicyModel()); - StateExecutor parentStateExcutor = null; + StateExecutor parentStateExecutor; - parentStateExcutor = new StateExecutor(new ExecutorFactoryImpl()); + parentStateExecutor = new StateExecutor(new ExecutorFactoryImpl()); AxState state = new AxState(); - parentStateExcutor.setContext(null, state, internalContext); + parentStateExecutor.setContext(null, state, internalContext); AxStateFinalizerLogic stateFinalizerLogic = new AxStateFinalizerLogic(); - msfe.setContext(parentStateExcutor, stateFinalizerLogic, internalContext); + msfe.setContext(parentStateExecutor, stateFinalizerLogic, internalContext); stateFinalizerLogic.setLogic("x > 1 2 ()"); assertThatThrownBy(msfe::prepare).hasMessage("failed to compile MVEL code for state NULL:0.0.0:NULL:NULL"); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java index 3d59c4b21..f6dd7d824 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java @@ -1,7 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2020 Nordix Foundation + * Copyright (C) 2019-2020, 2024 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,16 +22,16 @@ package org.onap.policy.apex.plugins.executor.mvel; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.HashMap; import java.util.Map; import java.util.Properties; import java.util.TreeMap; -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.apex.context.ContextException; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.DistributorParameters; @@ -49,12 +48,12 @@ import org.onap.policy.common.parameters.ParameterService; * Test the MvelTaskExecutor class. * */ -public class MvelTaskExecutorTest { +class MvelTaskExecutorTest { /** * Initiate Parameters. */ - @Before - public void initiateParameters() { + @BeforeEach + void initiateParameters() { ParameterService.register(new DistributorParameters()); ParameterService.register(new LockManagerParameters()); ParameterService.register(new PersistorParameters()); @@ -63,15 +62,15 @@ public class MvelTaskExecutorTest { /** * Clear Parameters. */ - @After - public void clearParameters() { + @AfterEach + void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.LOCKING_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.PERSISTENCE_GROUP_NAME); } @Test - public void testMvelTaskExecutor() throws StateMachineException, ContextException { + void testMvelTaskExecutor() throws StateMachineException, ContextException { MvelTaskExecutor mte = new MvelTaskExecutor(); assertNotNull(mte); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java index d81c3d13b..4a25730cc 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java @@ -1,7 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 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. @@ -22,13 +21,13 @@ package org.onap.policy.apex.plugins.executor.mvel; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.Properties; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.DistributorParameters; @@ -47,12 +46,12 @@ import org.onap.policy.common.parameters.ParameterService; * Test the MvelTaskSelectExecutor class. * */ -public class MvelTaskSelectExecutorTest { +class MvelTaskSelectExecutorTest { /** * Initiate Parameters. */ - @Before - public void initiateParameters() { + @BeforeEach + void initiateParameters() { ParameterService.register(new DistributorParameters()); ParameterService.register(new LockManagerParameters()); ParameterService.register(new PersistorParameters()); @@ -61,15 +60,15 @@ public class MvelTaskSelectExecutorTest { /** * Clear Parameters. */ - @After - public void clearParameters() { + @AfterEach + void clearParameters() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.LOCKING_GROUP_NAME); ParameterService.deregister(ContextParameterConstants.PERSISTENCE_GROUP_NAME); } @Test - public void testJavaTaskSelectExecutor() throws StateMachineException, ContextException { + void testJavaTaskSelectExecutor() throws StateMachineException, ContextException { MvelTaskSelectExecutor mtse = new MvelTaskSelectExecutor(); assertNotNull(mtse); |