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.guard | |
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.guard')
2 files changed, 8 insertions, 8 deletions
diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperatorTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperatorTest.java index 170bcdf7e..76b784101 100644 --- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperatorTest.java +++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperatorTest.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,13 +28,15 @@ import static org.mockito.Mockito.when; import java.util.Map; import org.junit.Before; 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.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.controlloop.actorserviceprovider.Util; import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException; +@RunWith(MockitoJUnitRunner.class) public class DecisionOperatorTest { private static final String ACTOR = "my-actor"; private static final String OPERATION = "my-name"; @@ -61,8 +63,6 @@ public class DecisionOperatorTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - when(factory.get(CLIENT)).thenReturn(client); oper = new MyOperator(); diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardConfigTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardConfigTest.java index d30c71172..2d929d544 100644 --- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardConfigTest.java +++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardConfigTest.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. @@ -29,12 +29,14 @@ import static org.mockito.Mockito.when; import java.util.concurrent.Executor; import org.junit.Before; 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.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.models.decisions.concepts.DecisionRequest; +@RunWith(MockitoJUnitRunner.class) public class GuardConfigTest { private static final String MY_CLIENT = "my-client"; private static final String PATH = "my-path"; @@ -59,8 +61,6 @@ public class GuardConfigTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - when(factory.get(MY_CLIENT)).thenReturn(client); params = GuardParams.builder().onapName(ONAP_NAME).onapComponent(ONAP_COMP).onapInstance(ONAP_INST) |