diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-10 14:30:01 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-10 14:30:01 +0000 |
commit | aa4d8afd0d10c79a0605bc9402da2dc7f838f8ee (patch) | |
tree | 1778a57bda3d8bac57cb19edeaca30fb68389d58 /aai-resources/src/test | |
parent | f80844c59b994da133af38b66b3403d3231553e3 (diff) |
Migrate Mockito 1 to version 2 in the resources service
- update mockito to version 2.4.0
- update eelf-core since it has a compile time dependency to mockito 1.10.19 in version 1
Issue-ID: AAI-3546
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I6ba724fe26b57e9a468bdeb89cadaa6f51e68634
Diffstat (limited to 'aai-resources/src/test')
7 files changed, 119 insertions, 65 deletions
diff --git a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java index bd93f73..cc021bc 100644 --- a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java +++ b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java @@ -19,6 +19,24 @@ */ package org.onap.aai; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; + import org.javatuples.Pair; import org.mockito.Mockito; import org.onap.aai.config.SpringContextAware; @@ -37,17 +55,6 @@ import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.core.*; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - public class HttpTestUtil extends RESTAPI { private static final Logger logger = LoggerFactory.getLogger(HttpTestUtil.class); diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java index d5c112b..4fd789f 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java @@ -19,9 +19,9 @@ */ package org.onap.aai.rest; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.Mockito.when; -import org.springframework.mock.web.MockHttpServletRequest; + import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; @@ -41,9 +41,9 @@ import org.junit.BeforeClass; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.mock.web.MockHttpServletRequest; public abstract class BulkProcessorTestAbstraction extends AAISetup { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java index 9d2a519..c9941dc 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java @@ -19,23 +19,32 @@ */ package org.onap.aai.rest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; - -import javax.ws.rs.core.*; - -import java.util.*; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.when; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ExampleConsumerTest extends AAISetup { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java index 84ac1a8..863b084 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java @@ -19,15 +19,32 @@ */ package org.onap.aai.rest; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + import org.json.JSONArray; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; import org.json.JSONException; import org.json.JSONObject; +import org.json.simple.parser.ParseException; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; @@ -36,22 +53,12 @@ import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; - import org.onap.aai.util.AAIConfig; import org.onap.aai.util.AAIConstants; import org.skyscreamer.jsonassert.JSONAssert; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.test.annotation.DirtiesContext; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.*; -import java.io.IOException; -import java.util.*; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; // TODO: Change the following test to use spring boot public class LegacyMoxyConsumerTest extends AAISetup { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java index c6885c7..f726e2c 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java @@ -19,8 +19,26 @@ */ package org.onap.aai.rest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; @@ -29,14 +47,8 @@ import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; - -import javax.ws.rs.core.*; -import java.io.IOException; -import java.util.*; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.when; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockHttpServletRequest; public class URLFromVertexIdConsumerTest extends AAISetup { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java index e4e7340..daa87d4 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java @@ -19,8 +19,26 @@ */ package org.onap.aai.rest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; @@ -29,14 +47,8 @@ import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; - -import javax.ws.rs.core.*; -import java.io.IOException; -import java.util.*; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.when; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockHttpServletRequest; public class VertexIdConsumerTest extends AAISetup { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java index a8e5583..21324e9 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java @@ -22,7 +22,7 @@ package org.onap.aai.rest.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -32,7 +32,14 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; -import javax.ws.rs.core.*; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; |