summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java18
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePipTest.java8
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequestTest.java8
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequestTest.java8
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPipTest.java8
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java8
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java18
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java8
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpPapRegistrationTest.java8
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisherTest.java12
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpStateChangeListenerTest.java8
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpUpdateListenerTest.java8
12 files changed, 50 insertions, 70 deletions
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java
index badc5f9c..e12a204e 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -21,8 +21,6 @@ package org.onap.policy.pdp.xacml.application.common.operationshistory;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import com.att.research.xacml.api.Attribute;
@@ -49,12 +47,14 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
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.guard.OperationsHistory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class CountRecentOperationsPipTest {
private static final Logger LOGGER = LoggerFactory.getLogger(CountRecentOperationsPipTest.class);
@@ -133,8 +133,6 @@ public class CountRecentOperationsPipTest {
*/
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
when(pipRequest.getIssuer()).thenReturn("urn:org:onap:xacml:guard:tw:1:hour");
pipEngine = new MyPip();
@@ -144,16 +142,8 @@ public class CountRecentOperationsPipTest {
properties.load(is);
}
- when(pipFinder.getMatchingAttributes(any(), eq(pipEngine))).thenReturn(resp1, resp2, resp3);
-
responses = new LinkedList<>(Arrays.asList(resp1, resp2, resp3));
attributes = new LinkedList<>(Arrays.asList(ACTOR, RECIPE, TARGET));
-
- when(resp1.getStatus()).thenReturn(okStatus);
- when(resp2.getStatus()).thenReturn(okStatus);
- when(resp3.getStatus()).thenReturn(okStatus);
-
- when(okStatus.isOk()).thenReturn(true);
}
@Test
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePipTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePipTest.java
index dd961d8c..61d923c2 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePipTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePipTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -45,13 +45,15 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
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.guard.OperationsHistory;
import org.onap.policy.pdp.xacml.application.common.ToscaDictionary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class GetOperationOutcomePipTest {
private static final Logger LOGGER = LoggerFactory.getLogger(GetOperationOutcomePipTest.class);
private static final String TEST_PROPERTIES = "src/test/resources/test.properties";
@@ -119,8 +121,6 @@ public class GetOperationOutcomePipTest {
*/
@Before
public void setupEngine() throws Exception {
- MockitoAnnotations.initMocks(this);
-
when(pipRequest.getIssuer()).thenReturn("urn:org:onap:xacml:guard:tw:1:hour");
//
// Create instance
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequestTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequestTest.java
index 7d7d0e6b..be7e0cea 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequestTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequestTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -32,10 +32,12 @@ import java.util.Map;
import java.util.TreeMap;
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.models.decisions.concepts.DecisionRequest;
+@RunWith(MockitoJUnitRunner.class)
public class StdCombinedPolicyRequestTest {
private static final String ACTION = "my-action";
private static final String ONAP_NAME = "my-name";
@@ -56,8 +58,6 @@ public class StdCombinedPolicyRequestTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
resources = new TreeMap<>();
when(decreq.getResource()).thenReturn(resources);
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequestTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequestTest.java
index f259c207..57ab227a 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequestTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequestTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -34,12 +34,14 @@ import java.util.Map;
import java.util.TreeMap;
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.models.decisions.concepts.DecisionRequest;
import org.onap.policy.pdp.xacml.application.common.ToscaDictionary;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
+@RunWith(MockitoJUnitRunner.class)
public class StdMatchablePolicyRequestTest {
private static final String ACTION = "my-action";
private static final String ONAP_NAME = "my-name";
@@ -62,8 +64,6 @@ public class StdMatchablePolicyRequestTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
resources = new TreeMap<>();
when(decreq.getResource()).thenReturn(resources);
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPipTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPipTest.java
index a0f85730..82347474 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPipTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPipTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -48,10 +48,12 @@ import java.util.Iterator;
import java.util.Properties;
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.pdp.xacml.application.common.ToscaDictionary;
+@RunWith(MockitoJUnitRunner.class)
public class StdOnapPipTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String MY_ID = "my-id";
@@ -81,8 +83,6 @@ public class StdOnapPipTest {
*/
@Before
public void setUp() throws PIPException {
- MockitoAnnotations.initMocks(this);
-
resp = new StdMutablePIPResponse();
when(request.getIssuer()).thenReturn(ISSUER);
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java
index 0552ff30..7d5dd664 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -53,8 +53,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
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.parameters.RestServerParameters;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
@@ -66,6 +67,7 @@ import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class StdXacmlApplicationServiceProviderTest {
private static final Logger logger = LoggerFactory.getLogger(StdXacmlApplicationServiceProviderTest.class);
@@ -131,8 +133,6 @@ public class StdXacmlApplicationServiceProviderTest {
*/
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
policy = new ToscaPolicy();
policy.setType(POLICY_TYPE);
policy.setName(POLICY_NAME);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
index 8fb7664e..86804425 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,12 +29,12 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.util.Arrays;
import org.junit.AfterClass;
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.utils.network.NetworkUtil;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
@@ -43,10 +43,10 @@ import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
+@RunWith(MockitoJUnitRunner.class)
public class XacmlStateTest {
private static final String PDP_TYPE = "xacml";
private static final String GROUP = "my-group";
@@ -59,9 +59,6 @@ public class XacmlStateTest {
@Mock
private XacmlPdpActivator act;
- private ToscaConceptIdentifier ident1;
- private ToscaConceptIdentifier ident2;
-
private String hostName;
private XacmlState state;
@@ -71,15 +68,8 @@ public class XacmlStateTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
hostName = NetworkUtil.getHostname();
- ident1 = new ToscaConceptIdentifier("nameA", "typeA");
- ident2 = new ToscaConceptIdentifier("nameB", "typeB");
-
- when(appmgr.getToscaPolicyTypeIdents()).thenReturn(Arrays.asList(ident1, ident2));
-
XacmlPdpActivator.setCurrent(act);
state = new XacmlState(appmgr, GROUP);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java
index 550091fa..7f902113 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -39,12 +39,14 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
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.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.pdpx.main.XacmlState;
+@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpHearbeatPublisherTest {
private static final long INTERVAL1 = 1000L;
@@ -79,8 +81,6 @@ public class XacmlPdpHearbeatPublisherTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
when(state.genHeartbeat()).thenReturn(status);
timers = new LinkedList<>(Arrays.asList(timer1, timer2));
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpPapRegistrationTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpPapRegistrationTest.java
index 9f35f530..9f4d80bc 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpPapRegistrationTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpPapRegistrationTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -25,12 +25,14 @@ import static org.mockito.Mockito.when;
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.client.TopicSinkClient;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClientException;
import org.onap.policy.models.pdp.concepts.PdpStatus;
+@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpPapRegistrationTest {
@Mock
@@ -46,8 +48,6 @@ public class XacmlPdpPapRegistrationTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
when(client.send(status)).thenReturn(true);
reg = new XacmlPdpPapRegistration(client);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisherTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisherTest.java
index c8c6a816..a4cee50a 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisherTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisherTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -21,8 +21,8 @@
package org.onap.policy.pdpx.main.comm;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.startsWith;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.startsWith;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -34,8 +34,9 @@ import java.util.List;
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.event.comm.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
@@ -50,6 +51,7 @@ import org.onap.policy.pdpx.main.rest.XacmlPdpStatisticsManager;
/**
* Initializes objects, including the publisher.
*/
+@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpUpdatePublisherTest {
private static final int NEW_COUNT = 4;
@@ -104,8 +106,6 @@ public class XacmlPdpUpdatePublisherTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
Map<ToscaPolicy, XacmlApplicationServiceProvider> deployedPolicies = new HashMap<>();
deployedPolicies.put(deployed1, null);
deployedPolicies.put(deployed2, null);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpStateChangeListenerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpStateChangeListenerTest.java
index a1b7e3e6..dbc065a1 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpStateChangeListenerTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpStateChangeListenerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -27,14 +27,16 @@ import static org.mockito.Mockito.when;
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.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.pdpx.main.XacmlState;
+@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpStateChangeListenerTest {
private static final String TOPIC = "my-topic";
@@ -57,8 +59,6 @@ public class XacmlPdpStateChangeListenerTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
listener = new XacmlPdpStateChangeListener(client, state);
when(state.shouldHandle(change)).thenReturn(true);
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpUpdateListenerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpUpdateListenerTest.java
index 39ba9017..17f71ddd 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpUpdateListenerTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/listeners/XacmlPdpUpdateListenerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -30,8 +30,9 @@ import static org.mockito.Mockito.when;
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.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
@@ -41,6 +42,7 @@ import org.onap.policy.pdpx.main.comm.XacmlPdpUpdatePublisher;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
import org.powermock.reflect.Whitebox;
+@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpUpdateListenerTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String TOPIC = "my-topic";
@@ -70,8 +72,6 @@ public class XacmlPdpUpdateListenerTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
listener = new MyListener(client, state, heartbeat, appmgr);
update = new PdpUpdate();