This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new cfac1c48d3 Bump to mockito 4.x
cfac1c48d3 is described below

commit cfac1c48d3c2949871fb8db1e5acb8119113e3b4
Author: Stephen Mallette <[email protected]>
AuthorDate: Tue Dec 27 07:10:27 2022 -0500

    Bump to mockito 4.x
    
    Removed PowerMock since it isn't compatible with mockito 4.x and no longer 
seems maintained. It was also only used for a single unit test in the whole 
project and that test is one that seems covered under integration tests. CTR
---
 .../strategy/decoration/PartitionStrategyTest.java |  4 +-
 gremlin-driver/pom.xml                             | 14 ++--
 .../tinkerpop/gremlin/driver/ClientTest.java       | 88 ----------------------
 .../server/op/AbstractEvalOpProcessorTest.java     |  2 +-
 gremlin-util/pom.xml                               | 10 ---
 pom.xml                                            | 37 +--------
 .../TinkerGraphGryoSerializerV1d0Test.java         |  6 +-
 .../TinkerGraphGryoSerializerV2d0Test.java         |  6 +-
 .../TinkerGraphGryoSerializerV3d0Test.java         |  6 +-
 9 files changed, 18 insertions(+), 155 deletions(-)

diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
index 7bc80b326f..a767708d15 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
@@ -46,11 +46,11 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import static org.hamcrest.core.IsIterableContaining.hasItem;
 import static org.junit.Assert.assertEquals;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsCollectionContaining.hasItem;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
diff --git a/gremlin-driver/pom.xml b/gremlin-driver/pom.xml
index 8c21eef252..97aeab3260 100644
--- a/gremlin-driver/pom.xml
+++ b/gremlin-driver/pom.xml
@@ -81,18 +81,14 @@ limitations under the License.
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>io.github.hakky54</groupId>
-            <artifactId>logcaptor</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.powermock</groupId>
-            <artifactId>powermock-module-junit4</artifactId>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-inline</artifactId>
+            <version>4.10.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.powermock</groupId>
-            <artifactId>powermock-api-mockito2</artifactId>
+            <groupId>io.github.hakky54</groupId>
+            <artifactId>logcaptor</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientTest.java
deleted file mode 100644
index b69d3219d8..0000000000
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.driver;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException;
-
-import java.util.Collections;
-import java.util.Optional;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import static org.mockito.Mockito.when;
-import static org.powermock.api.mockito.PowerMockito.whenNew;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Client.ClusteredClient.class, Client.SessionedClient.class, 
Host.class, Cluster.class})
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", 
"javax.management.*"})
-public class ClientTest {
-    @Mock
-    private Cluster cluster;
-
-    @Mock
-    private Host mockAvailableHost;
-
-    @Mock
-    private Client.Settings settings;
-
-    private ScheduledExecutorService executor;
-    private ScheduledExecutorService scheduler;
-
-    @Before
-    public void setup() {
-        executor = Executors.newScheduledThreadPool(1);
-        scheduler = Executors.newScheduledThreadPool(1);
-        when(mockAvailableHost.isAvailable()).thenReturn(true);
-        
when(cluster.allHosts()).thenReturn(Collections.singletonList(mockAvailableHost));
-        when(cluster.executor()).thenReturn(executor);
-        when(cluster.hostScheduler()).thenReturn(scheduler);
-    }
-
-    @After
-    public void cleanup() {
-        executor.shutdown();
-        scheduler.shutdown();
-    }
-
-    @Test(expected = NoHostAvailableException.class)
-    public void shouldThrowErrorWhenConnPoolInitFailsForClusteredClient() 
throws Exception {
-        Client.ClusteredClient client = new Client.ClusteredClient(cluster, 
settings);
-        whenNew(ConnectionPool.class).withAnyArguments().thenThrow(new 
RuntimeException("cannot initialize client"));
-        client.init();
-    }
-
-    @Test(expected = NoHostAvailableException.class)
-    public void shouldThrowErrorWhenConnPoolInitFailsForSessionClient() throws 
Exception {
-        final Client.SessionSettings sessionSettings = 
Client.SessionSettings.build().sessionId("my-session-id").create();
-        when(settings.getSession()).thenReturn(Optional.of(sessionSettings));
-        Client.SessionedClient client = new Client.SessionedClient(cluster, 
settings);
-        whenNew(ConnectionPool.class).withAnyArguments().thenThrow(new 
RuntimeException("cannot initialize client"));
-        client.init();
-    }
-
-}
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessorTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessorTest.java
index e40a4f0bec..42852f4975 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessorTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessorTest.java
@@ -38,7 +38,7 @@ import java.util.concurrent.CompletableFuture;
 
 import static org.junit.Assert.assertEquals;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.anyString;
 
 public class AbstractEvalOpProcessorTest {
 
diff --git a/gremlin-util/pom.xml b/gremlin-util/pom.xml
index b8f58186bd..ec8bffec68 100644
--- a/gremlin-util/pom.xml
+++ b/gremlin-util/pom.xml
@@ -55,16 +55,6 @@
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.powermock</groupId>
-            <artifactId>powermock-module-junit4</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.powermock</groupId>
-            <artifactId>powermock-api-mockito2</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest</artifactId>
diff --git a/pom.xml b/pom.xml
index 8ec63aa5d2..6daeef426c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -177,12 +177,11 @@ limitations under the License.
         <kerby.version>2.0.1</kerby.version>
         <logback.version>1.2.11</logback.version>
         <metrics.version>3.0.2</metrics.version>
-        <mockito.version>3.3.3</mockito.version>
+        <mockito.version>4.10.0</mockito.version>
         <netty.version>4.1.86.Final</netty.version>
         <slf4j.version>1.7.25</slf4j.version>
         <snakeyaml.version>1.32</snakeyaml.version>
         <spark.version>3.2.1</spark.version>
-        <powermock.version>2.0.9</powermock.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -781,40 +780,6 @@ limitations under the License.
                 <artifactId>objenesis</artifactId>
                 <version>3.3</version>
             </dependency>
-            <dependency>
-                <groupId>org.powermock</groupId>
-                <artifactId>powermock-module-junit4</artifactId>
-                <version>${powermock.version}</version>
-                <scope>test</scope>
-                <exclusions>
-                    <!-- conflict with mockito - excluding from the mockito 
side doesn't work -->
-                    <exclusion>
-                        <groupId>net.bytebuddy</groupId>
-                        <artifactId>byte-buddy</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>net.bytebuddy</groupId>
-                        <artifactId>byte-buddy-agent</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.powermock</groupId>
-                <artifactId>powermock-api-mockito2</artifactId>
-                <version>${powermock.version}</version>
-                <scope>test</scope>
-                <exclusions>
-                    <!-- conflict with mockito - excluding from the mockito 
side doesn't work -->
-                    <exclusion>
-                        <groupId>net.bytebuddy</groupId>
-                        <artifactId>byte-buddy</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>net.bytebuddy</groupId>
-                        <artifactId>byte-buddy-agent</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
             <dependency>
                 <groupId>org.hamcrest</groupId>
                 <artifactId>hamcrest</artifactId>
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV1d0Test.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV1d0Test.java
index fff3be6b33..3413cea6b2 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV1d0Test.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV1d0Test.java
@@ -27,12 +27,12 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import java.util.Arrays;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV2d0Test.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV2d0Test.java
index 755159139a..79c50707c8 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV2d0Test.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV2d0Test.java
@@ -27,12 +27,12 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import java.util.Arrays;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV3d0Test.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV3d0Test.java
index 2b18c3b3ba..55472df746 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV3d0Test.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGryoSerializerV3d0Test.java
@@ -27,12 +27,12 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import java.util.Arrays;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;

Reply via email to