diff options
author | Jim Hahn <jrh3@att.com> | 2021-02-11 17:06:38 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-02-11 17:09:55 -0500 |
commit | ec348b97648f1e927365d17d376495bbd2b39c67 (patch) | |
tree | b81f91fedc7e774ac8c055950577d21b5f21be62 /models-interactions/model-actors/actor.test/src | |
parent | b7097d21c25a48c9d209548ac8afdc09b1679457 (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/actor.test/src')
2 files changed, 6 insertions, 6 deletions
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java index 539202c4a..766e0fb2d 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.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. @@ -93,7 +93,7 @@ public class BasicOperation { * Initializes mocks and sets up. */ public void setUpBasic() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); future = new CompletableFuture<>(); diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index 6cccc5cb7..c708a17cd 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.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. @@ -33,14 +33,16 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.simulators.TopicServer; +@RunWith(MockitoJUnitRunner.class) public class BasicBidirectionalTopicOperationTest { private static final String ACTOR = "my-actor"; private static final String OPERATION = "my-operation"; @@ -66,8 +68,6 @@ public class BasicBidirectionalTopicOperationTest { */ @Before public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - oper = new MyOperation(ACTOR, OPERATION); oper.setUpBasic(); } |