From ec348b97648f1e927365d17d376495bbd2b39c67 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 11 Feb 2021 17:06:38 -0500 Subject: 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 --- .../java/org/onap/policy/simulators/AppcLcmTopicServerTest.java | 8 ++++---- .../org/onap/policy/simulators/AppcLegacyTopicServerTest.java | 8 ++++---- .../test/java/org/onap/policy/simulators/SdnrTopicServerTest.java | 8 ++++---- .../src/test/java/org/onap/policy/simulators/TopicServerTest.java | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'models-interactions/model-simulators/src') 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(); } -- cgit 1.2.3-korg