summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-27 11:14:36 -0400
committerJim Hahn <jrh3@att.com>2021-08-27 12:42:29 -0400
commit18c8028c79d1bdd7bca80fe1e22e2cd9bc072695 (patch)
tree14441d6b1b4b5e50022153ac534e4783cd875aeb /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src
parenta90a763fa3c9260c3a5e08440ec99e4438852e77 (diff)
Address eclipse warnings in apex-pdp
Fixed: - deprecated mockito methods - unused mocks Issue-ID: POLICY-3093 Change-Id: I20d9aebb2a6390b2a3c95ae9ccc59b710b9e58ce Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java25
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java20
2 files changed, 2 insertions, 43 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
index 20d6feb5b..545499b40 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
@@ -40,8 +40,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
@@ -73,8 +72,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerErrors() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -105,11 +102,8 @@ public class ApexRestClientConusmerTest {
assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
rcctp.setUrl("http://some.place.that.does.not/exist");
- Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
- Mockito.doReturn(responseMock).when(builderMock).get();
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
// We have not set the URL, this test should not receive any events
@@ -118,8 +112,6 @@ public class ApexRestClientConusmerTest {
arcc.stop();
assertEquals(0, incomingEventReceiver.getEventCount());
- Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
-
// We have not set the URL, this test should not receive any events
arcc.start();
await().atMost(200, TimeUnit.MILLISECONDS).until(() -> incomingEventReceiver.getEventCount() == 0);
@@ -129,8 +121,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerHttpError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -156,7 +146,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -171,8 +160,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -196,7 +183,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -212,8 +198,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonEmpty() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -239,7 +223,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -260,8 +243,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonOk() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -287,7 +268,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
// We have not set the URL, this test should not receive any events
@@ -299,8 +279,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerInvalidStatusCode() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -326,7 +304,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
index ac35081f2..85a6214fb 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
@@ -35,8 +35,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
@@ -107,8 +106,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPutEvent() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -135,8 +132,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventFail() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -150,11 +145,6 @@ public class ApexRestClientProducerTest {
assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
- Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
- Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
- Mockito.doReturn(builderMock).when(targetMock).request("application/json");
- Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
// test property not found
@@ -171,8 +161,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventOK() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -203,8 +191,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventCache() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -237,8 +223,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventCacheTrace() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -271,8 +255,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerHttpError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);