From c7f83ca3344c52da125fc1efa217b666b74d57a6 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 13 Oct 2022 09:36:18 +0000 Subject: Migrate Mockito 1 to version 2 in aai-core Issue-ID: AAI-3549 Signed-off-by: Fiete Ostkamp Change-Id: Ibb8edcd80fe3b112af0d113894122ce0b256006b --- aai-annotations/.classpath | 18 +++++++++++++++ aai-core/pom.xml | 14 ++--------- .../aai/prevalidation/ValidationServiceTest.java | 25 ++++++++++---------- .../queryformats/QueryFormatTestHelper.java | 4 ++-- .../queryformats/SimpleFormatTest.java | 27 ++++++++++++++-------- .../queryformats/utils/QueryParamInjectorTest.java | 3 +-- .../queryformats/utils/UrlBuilderTest.java | 3 +-- aai-schema-ingest/.classpath | 16 ++++++++++++- 8 files changed, 70 insertions(+), 40 deletions(-) diff --git a/aai-annotations/.classpath b/aai-annotations/.classpath index af1430be..f0257c5a 100644 --- a/aai-annotations/.classpath +++ b/aai-annotations/.classpath @@ -10,6 +10,7 @@ + @@ -22,5 +23,22 @@ + + + + + + + + + + + + + + + + + diff --git a/aai-core/pom.xml b/aai-core/pom.xml index d6a4c77b..1b91577e 100644 --- a/aai-core/pom.xml +++ b/aai-core/pom.xml @@ -38,6 +38,7 @@ limitations under the License. 0.50 3.2.2 2.5.15 + 2.4.0 https://wiki.onap.org/ v15 @@ -133,13 +134,7 @@ limitations under the License. com.att.eelf eelf-core - - - org.powermock - powermock-api-mockito - - + 2.0.0-oss org.codehaus.jackson @@ -164,11 +159,6 @@ limitations under the License. hamcrest-core test - - org.mockito - mockito-all - test - org.mockito mockito-core diff --git a/aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java b/aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java index 883c8b61..8ff021e0 100644 --- a/aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java +++ b/aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java @@ -20,7 +20,18 @@ package org.onap.aai.prevalidation; -import com.google.gson.Gson; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + +import java.io.IOException; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.util.List; + import org.apache.http.conn.ConnectTimeoutException; import org.junit.Before; import org.junit.Rule; @@ -33,17 +44,7 @@ import org.springframework.boot.test.rule.OutputCapture; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import java.io.IOException; -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.util.List; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import com.google.gson.Gson; public class ValidationServiceTest { diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java index f05e36dd..7cb390aa 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java @@ -20,7 +20,7 @@ package org.onap.aai.serialization.queryformats; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.when; import java.io.IOException; @@ -46,7 +46,7 @@ public class QueryFormatTestHelper { public static void mockPathed(UrlBuilder mock) throws AAIFormatVertexException { Answer answer = new Answer() { public String answer(InvocationOnMock invocation) throws Throwable { - Vertex v = invocation.getArgumentAt(0, Vertex.class); + Vertex v = invocation.getArgument(0); return v.property(AAIProperties.AAI_URI).orElse("urimissing"); } diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java index 3b356178..bf8a1c9e 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java @@ -20,7 +20,23 @@ package org.onap.aai.serialization.queryformats; -import com.google.gson.JsonObject; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.UnsupportedEncodingException; +import java.util.Arrays; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; + import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.T; @@ -44,14 +60,7 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti import org.onap.aai.serialization.queryformats.utils.UrlBuilder; import org.springframework.test.annotation.DirtiesContext; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; +import com.google.gson.JsonObject; @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS) public class SimpleFormatTest extends AAISetup { diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java index ed043361..0ac12165 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java @@ -29,11 +29,10 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.Loader; import org.onap.aai.serialization.db.DBSerializer; -import org.onap.aai.serialization.queryformats.Resource; import org.onap.aai.serialization.queryformats.Resource.Builder; @RunWith(MockitoJUnitRunner.class) diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java index d19ed1a7..c9e061c1 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java @@ -21,7 +21,7 @@ package org.onap.aai.serialization.queryformats.utils; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.io.UnsupportedEncodingException; @@ -38,7 +38,6 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.util.AAIConstants; public class UrlBuilderTest extends AAISetup { diff --git a/aai-schema-ingest/.classpath b/aai-schema-ingest/.classpath index 0f930ed4..5c8072ec 100644 --- a/aai-schema-ingest/.classpath +++ b/aai-schema-ingest/.classpath @@ -10,11 +10,13 @@ + + @@ -27,9 +29,21 @@ - + + + + + + + + + + + + + -- cgit 1.2.3-korg