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-simulators | |
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-simulators')
4 files changed, 16 insertions, 16 deletions
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLcmTopicServerTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLcmTopicServerTest.java index f3f546a41..9560658a8 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLcmTopicServerTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLcmTopicServerTest.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,14 +28,16 @@ import static org.mockito.Mockito.verify; import org.junit.Before; 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.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.utils.resources.ResourceUtils; +@RunWith(MockitoJUnitRunner.class) public class AppcLcmTopicServerTest { private static final String MY_TOPIC = "my-topic"; @@ -51,8 +53,6 @@ public class AppcLcmTopicServerTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - server = new AppcLcmTopicServer(sink, source); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLegacyTopicServerTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLegacyTopicServerTest.java index c3c3195df..25cba30bd 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLegacyTopicServerTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AppcLegacyTopicServerTest.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,14 +28,16 @@ import static org.mockito.Mockito.verify; import org.junit.Before; 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.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.utils.resources.ResourceUtils; +@RunWith(MockitoJUnitRunner.class) public class AppcLegacyTopicServerTest { private static final String MY_TOPIC = "my-topic"; @@ -51,8 +53,6 @@ public class AppcLegacyTopicServerTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - server = new AppcLegacyTopicServer(sink, source); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SdnrTopicServerTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SdnrTopicServerTest.java index d8f6d1150..96ea9fbcc 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SdnrTopicServerTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SdnrTopicServerTest.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,14 +28,16 @@ import static org.mockito.Mockito.verify; import org.junit.Before; 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.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.utils.resources.ResourceUtils; +@RunWith(MockitoJUnitRunner.class) public class SdnrTopicServerTest { private static final String MY_TOPIC = "my-topic"; @@ -51,8 +53,6 @@ public class SdnrTopicServerTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - server = new SdnrTopicServer(sink, source); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/TopicServerTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/TopicServerTest.java index 11a5e3f81..972769ddd 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/TopicServerTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/TopicServerTest.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.verify; 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.event.comm.Topic.CommInfrastructure; 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.StandardCoder; +@RunWith(MockitoJUnitRunner.class) public class TopicServerTest { private static final String MY_TOPIC = "my-topic"; private static final String TEXT = "hello"; @@ -52,8 +54,6 @@ public class TopicServerTest { */ @Before public void setUp() { - MockitoAnnotations.initMocks(this); - server = new MyServer(); } |