diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-13 09:36:18 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-13 09:36:18 +0000 |
commit | c7f83ca3344c52da125fc1efa217b666b74d57a6 (patch) | |
tree | 2a90ad7b2c0ea499f7942e9342b171358ba3db48 /aai-core/src/test | |
parent | 8183d5972a9f1a4b0515c99a87047a5d12db5af2 (diff) |
Migrate Mockito 1 to version 2 in aai-core
Issue-ID: AAI-3549
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: Ibb8edcd80fe3b112af0d113894122ce0b256006b
Diffstat (limited to 'aai-core/src/test')
5 files changed, 35 insertions, 27 deletions
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<String> answer = new Answer<String>() { public String answer(InvocationOnMock invocation) throws Throwable { - Vertex v = invocation.getArgumentAt(0, Vertex.class); + Vertex v = invocation.getArgument(0); return v.<String>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 { |