aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-02-11 17:06:38 -0500
committerJim Hahn <jrh3@att.com>2021-02-11 17:09:55 -0500
commitec348b97648f1e927365d17d376495bbd2b39c67 (patch)
treeb81f91fedc7e774ac8c055950577d21b5f21be62 /models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
parentb7097d21c25a48c9d209548ac8afdc09b1679457 (diff)
Fix sonars from depeendency upgrade
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner, in most cases. Changed to openMocks() in one case and removed unnecessary stubbings. Issue-ID: POLICY-2905 Change-Id: I9aa098aa7aaebba09f6dcea4cac69ac1e5fbd4d6 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java21
1 files changed, 4 insertions, 17 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
index f6dbcd85f..d617a72ee 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,8 +28,6 @@ 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.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
import ch.qos.logback.classic.Logger;
import java.time.Instant;
@@ -59,8 +57,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.Coder;
@@ -80,6 +79,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.OperatorConfi
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class OperationPartialTest {
private static final CommInfrastructure SINK_INFRA = CommInfrastructure.NOOP;
private static final CommInfrastructure SOURCE_INFRA = CommInfrastructure.UEB;
@@ -160,18 +160,12 @@ public class OperationPartialTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
executor = new PseudoExecutor();
params = ControlLoopOperationParams.builder().completeCallback(this::completer).requestId(REQ_ID)
.executor(executor).actorService(service).actor(ACTOR).operation(OPERATION).timeoutSec(TIMEOUT)
.startCallback(this::starter).build();
- when(service.getActor(OperationPartial.GUARD_ACTOR_NAME)).thenReturn(guardActor);
- when(guardActor.getOperator(OperationPartial.GUARD_OPERATION_NAME)).thenReturn(guardOperator);
- when(guardOperator.buildOperation(any())).thenReturn(guardOperation);
- when(guardOperation.start()).thenReturn(CompletableFuture.completedFuture(makeSuccess()));
-
config = new OperatorConfig(executor);
oper = new MyOper();
@@ -1048,13 +1042,6 @@ public class OperationPartialTest {
};
}
- private OperationOutcome makeSuccess() {
- OperationOutcome outcome = params.makeOutcome();
- outcome.setResult(OperationResult.SUCCESS);
-
- return outcome;
- }
-
/**
* Verifies a run.
*