Fix sonars from depeendency upgrade
[policy/models.git] / models-interactions / model-actors / actorServiceProvider / src / test / java / org / onap / policy / controlloop / actorserviceprovider / impl / BidirectionalTopicOperationTest.java
index 14b1daf..662f864 100644 (file)
@@ -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.
@@ -44,10 +44,11 @@ import lombok.Getter;
 import lombok.Setter;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
 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.utils.coder.Coder;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -61,6 +62,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
 import org.onap.policy.controlloop.actorserviceprovider.topic.BidirectionalTopicHandler;
 import org.onap.policy.controlloop.actorserviceprovider.topic.Forwarder;
 
+@RunWith(MockitoJUnitRunner.class)
 public class BidirectionalTopicOperationTest {
     private static final CommInfrastructure SINK_INFRA = CommInfrastructure.NOOP;
     private static final IllegalStateException EXPECTED_EXCEPTION = new IllegalStateException("expected exception");
@@ -98,8 +100,6 @@ public class BidirectionalTopicOperationTest {
      */
     @Before
     public void setUp() throws CoderException {
-        MockitoAnnotations.initMocks(this);
-
         when(config.getTopicHandler()).thenReturn(handler);
         when(config.getForwarder()).thenReturn(forwarder);
         when(config.getTimeoutMs()).thenReturn(TIMEOUT_MS);
@@ -110,7 +110,7 @@ public class BidirectionalTopicOperationTest {
         executor = new PseudoExecutor();
 
         params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).executor(executor).build();
-        outcome = params.makeOutcome(null);
+        outcome = params.makeOutcome();
 
         response = new MyResponse();
         response.setRequestId(REQ_ID);
@@ -166,7 +166,7 @@ public class BidirectionalTopicOperationTest {
         assertEquals(OperationResult.SUCCESS, outcome.getResult());
         assertEquals(response, outcome.getResponse());
 
-        verify(forwarder).unregister(eq(Arrays.asList(REQ_ID)), eq(listenerCaptor.getValue()));
+        verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue());
     }
 
     /**
@@ -194,7 +194,7 @@ public class BidirectionalTopicOperationTest {
         assertTrue(executor.runAll(MAX_REQUESTS));
         assertTrue(future.isCompletedExceptionally());
 
-        verify(forwarder).unregister(eq(Arrays.asList(REQ_ID)), eq(listenerCaptor.getValue()));
+        verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue());
     }
 
     /**
@@ -210,7 +210,7 @@ public class BidirectionalTopicOperationTest {
         verify(forwarder).register(eq(Arrays.asList(REQ_ID)), listenerCaptor.capture());
 
         // must still unregister
-        verify(forwarder).unregister(eq(Arrays.asList(REQ_ID)), eq(listenerCaptor.getValue()));
+        verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue());
     }
 
     @Test