summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-10-13 09:36:18 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-10-13 09:36:18 +0000
commitc7f83ca3344c52da125fc1efa217b666b74d57a6 (patch)
tree2a90ad7b2c0ea499f7942e9342b171358ba3db48
parent8183d5972a9f1a4b0515c99a87047a5d12db5af2 (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
-rw-r--r--aai-annotations/.classpath18
-rw-r--r--aai-core/pom.xml14
-rw-r--r--aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java25
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java27
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java3
-rw-r--r--aai-schema-ingest/.classpath16
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 @@
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
@@ -22,5 +23,22 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path="target/generated-sources/annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
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.
<jacoco.line.coverage.limit>0.50</jacoco.line.coverage.limit>
<gremlin.version>3.2.2</gremlin.version>
<groovy.version>2.5.15</groovy.version>
+ <mockito.core.version>2.4.0</mockito.core.version>
<!-- Start of Default ONAP Schema Properties -->
<aai.wiki.link>https://wiki.onap.org/</aai.wiki.link>
<gendoc.version>v15</gendoc.version>
@@ -133,13 +134,7 @@ limitations under the License.
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
- <exclusions><!-- excluding transitive dependency coming from this artifact,
- as we would need powermock-api-mockito2 -->
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- </exclusions>
+ <version>2.0.0-oss</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
@@ -166,11 +161,6 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
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 {
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 @@
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
@@ -27,9 +29,21 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ <attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>