Migrate Mockito 1 to version 2 in aai-core 60/131460/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 13 Oct 2022 09:36:18 +0000 (09:36 +0000)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 13 Oct 2022 09:36:18 +0000 (09:36 +0000)
Issue-ID: AAI-3549

Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: Ibb8edcd80fe3b112af0d113894122ce0b256006b

aai-annotations/.classpath
aai-core/pom.xml
aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/QueryFormatTestHelper.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjectorTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/utils/UrlBuilderTest.java
aai-schema-ingest/.classpath

index af1430b..f0257c5 100644 (file)
@@ -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">
                        <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>
index d6a4c77..1b91577 100644 (file)
@@ -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>
@@ -164,11 +159,6 @@ limitations under the License.
                        <artifactId>hamcrest-core</artifactId>
                        <scope>test</scope>
                </dependency>
-               <dependency>
-                       <groupId>org.mockito</groupId>
-                       <artifactId>mockito-all</artifactId>
-                       <scope>test</scope>
-               </dependency>
                <dependency>
                        <groupId>org.mockito</groupId>
                        <artifactId>mockito-core</artifactId>
index 883c8b6..8ff021e 100644 (file)
 
 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 {
 
index f05e36d..7cb390a 100644 (file)
@@ -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");
             }
index 3b35617..bf8a1c9 100644 (file)
 
 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 {
index ed04336..0ac1216 100644 (file)
@@ -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)
index d19ed1a..c9e061c 100644 (file)
@@ -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 {
 
index 0f930ed..5c8072e 100644 (file)
                <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">
                        <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"/>