aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appclcm
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-06-13 09:19:14 +0100
committerwaynedunican <wayne.dunican@est.tech>2024-06-20 12:24:23 +0100
commit9e8684c88435734cb2e142208436cec647cde887 (patch)
treeb06334cdf8309d36ceba948797ff071d14a2e82d /models-interactions/model-actors/actor.appclcm
parent8236c8bab1a27bd721586550f8ba879abcba3239 (diff)
Convert models to JUnit 5
Review for models-actors Issue-ID: POLICY-5042 Change-Id: Ica07b9fbda1eca24a8a432d57a2d9af52c84625d Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm')
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorTest.java10
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java72
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java18
3 files changed, 50 insertions, 50 deletions
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorTest.java
index 3ac57603b..96961f434 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,15 +21,15 @@
package org.onap.policy.controlloop.actor.appclcm;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AppcLcmActorTest {
+class AppcLcmActorTest {
@Test
- public void testConstructor() {
+ void testConstructor() {
AppcLcmActor prov = new AppcLcmActor();
assertEquals(-1, prov.getSequenceNumber());
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
index e933621e9..8fa165f6f 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
@@ -24,25 +24,25 @@ package org.onap.policy.controlloop.actor.appclcm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
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.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
import org.onap.policy.appclcm.AppcLcmMessageWrapper;
@@ -64,8 +64,8 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.simulators.AppcLcmTopicServer;
import org.onap.policy.simulators.TopicServer;
-@RunWith(MockitoJUnitRunner.class)
-public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcLcmMessageWrapper> {
+@ExtendWith(MockitoExtension.class)
+ class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcLcmMessageWrapper> {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String PAYLOAD_KEY1 = "key-A";
@@ -78,21 +78,21 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
private AppcLcmMessageWrapper response;
private AppcLcmOperation oper;
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
+ @BeforeAll
+ static void setUpBeforeClass() throws Exception {
initBeforeClass(MY_SINK, MY_SOURCE);
}
- @AfterClass
- public static void tearDownAfterClass() {
+ @AfterAll
+ static void tearDownAfterClass() {
destroyAfterClass();
}
/**
* Sets up.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
super.setUpBasic();
response = makeResponse();
@@ -101,8 +101,8 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
super.tearDownBasic();
}
@@ -115,7 +115,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
* Tests "success" case with simulator.
*/
@Test
- public void testSuccess() throws Exception {
+ void testSuccess() throws Exception {
BidirectionalTopicParams opParams =
BidirectionalTopicParams.builder().sinkTopic(MY_SINK).sourceTopic(MY_SOURCE).build();
config = new BidirectionalTopicConfig(blockingExecutor, opParams, topicMgr, AppcLcmOperation.SELECTOR_KEYS);
@@ -132,18 +132,18 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testConstructor() {
+ void testConstructor() {
assertEquals(DEFAULT_ACTOR, oper.getActorName());
assertEquals(DEFAULT_OPERATION, oper.getName());
}
@Test
- public void testGetPropertyNames() {
+ void testGetPropertyNames() {
assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_TARGET_ENTITY));
}
@Test
- public void testMakeRequest() {
+ void testMakeRequest() {
oper.generateSubRequestId(2);
String subreq = oper.getSubRequestId();
assertNotNull(subreq);
@@ -167,7 +167,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
* Tests makeRequest() when a property is missing.
*/
@Test
- public void testMakeRequestMissingProperty() throws Exception {
+ void testMakeRequestMissingProperty() throws Exception {
oper = new AppcLcmOperation(params, config);
oper.generateSubRequestId(1);
@@ -176,7 +176,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testConvertPayload() {
+ void testConvertPayload() {
// only builds a payload for ConfigModify
params = params.toBuilder().operation(AppcLcmConstants.OPERATION_CONFIG_MODIFY).build();
oper = new AppcLcmOperation(params, config);
@@ -207,7 +207,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testGetExpectedKeyValues() {
+ void testGetExpectedKeyValues() {
oper.generateSubRequestId(2);
AppcLcmMessageWrapper request = oper.makeRequest(2);
assertEquals(List.of(request.getBody().getInput().getCommonHeader().getSubRequestId()),
@@ -215,7 +215,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testDetmStatus() {
+ void testDetmStatus() {
assertEquals(Status.SUCCESS, oper.detmStatus(null, response));
// failure
@@ -244,7 +244,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testSetOutcome() {
+ void testSetOutcome() {
oper.setOutcome(outcome, OperationResult.SUCCESS, response);
assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertEquals(MY_MESSAGE, outcome.getMessage());
@@ -270,7 +270,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testGetStatus() {
+ void testGetStatus() {
assertNotNull(oper.getStatus(response));
// null status
@@ -290,14 +290,14 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
- public void testOperationSupportsPayload() {
+ void testOperationSupportsPayload() {
// these should support a payload
Set<String> supported = Set.of(AppcLcmConstants.OPERATION_CONFIG_MODIFY);
for (String name : supported) {
params = params.toBuilder().operation(name).build();
oper = new AppcLcmOperation(params, config);
- assertTrue(name, oper.operationSupportsPayload());
+ assertTrue(oper.operationSupportsPayload(), name);
}
// these should NOT support a payload
@@ -307,7 +307,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
for (String name : unsupported) {
params = params.toBuilder().operation(name).build();
oper = new AppcLcmOperation(params, config);
- assertFalse(name, oper.operationSupportsPayload());
+ assertFalse(oper.operationSupportsPayload(), name);
}
// pick an operation that would ordinarily support payloads
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
index 110dfabd9..6f1e8f02e 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
@@ -3,7 +3,7 @@
*
* ================================================================================
* Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,14 @@
package org.onap.policy.controlloop.actor.appclcm;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AppcLcmRecipeFormatterTest {
+class AppcLcmRecipeFormatterTest {
@Test
- public void testShouldCorrectlyFormatRestartRequestWhenRestartGiven() {
+ void testShouldCorrectlyFormatRestartRequestWhenRestartGiven() {
// given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart");
String expectedUrlRecipe = "restart";
@@ -44,7 +44,7 @@ public class AppcLcmRecipeFormatterTest {
}
@Test
- public void testShouldReturnCapitalizedBodySingleWordRecipe() {
+ void testShouldReturnCapitalizedBodySingleWordRecipe() {
// given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify");
String expectedRecipe = "Modify";
@@ -57,7 +57,7 @@ public class AppcLcmRecipeFormatterTest {
}
@Test
- public void testShouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
+ void testShouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
// given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify");
String expectedRecipe = "ConfigModify";
@@ -70,7 +70,7 @@ public class AppcLcmRecipeFormatterTest {
}
@Test
- public void testShouldReturnLowercasedUrlSingleWordRecipe() {
+ void testShouldReturnLowercasedUrlSingleWordRecipe() {
// given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy");
String expectedRecipe = "modify";
@@ -83,7 +83,7 @@ public class AppcLcmRecipeFormatterTest {
}
@Test
- public void testShouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
+ void testShouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
// given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify");
String expectedRecipe = "config-modify";