diff options
author | William Reehil <william.reehil@att.com> | 2022-10-13 13:32:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-10-13 13:32:11 +0000 |
commit | 271e8f5f853c7ed8c277f5c12607a4633dd5b136 (patch) | |
tree | 7e0f81011539646f1ca44bc5949c64deb0c596e0 /aai-core/src/test | |
parent | 5175ddc0991f9bcf594394f9abbc85fdbca3cb9f (diff) | |
parent | c7f83ca3344c52da125fc1efa217b666b74d57a6 (diff) |
Merge "Migrate Mockito 1 to version 2 in aai-core"
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 { |