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

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


The following commit(s) were added to refs/heads/master by this push:
     new b72bcacf8e1 IGNITE-28237: Finalize Mockito 5 migration and fix 
incompatible tests (#12902)
b72bcacf8e1 is described below

commit b72bcacf8e1f61b6eb6ebb7f9380be01a8b5fe65
Author: Kirill Anisimov <[email protected]>
AuthorDate: Fri Mar 20 13:05:18 2026 +0700

    IGNITE-28237: Finalize Mockito 5 migration and fix incompatible tests 
(#12902)
---
 .../wal/record/WALRecordSerializationTest.java     | 38 +++++++++++++---------
 .../ClientSlowDiscoveryTransactionRemapTest.java   | 30 +++++++++++++----
 2 files changed, 47 insertions(+), 21 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/wal/record/WALRecordSerializationTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/wal/record/WALRecordSerializationTest.java
index f2312fdbf7e..2b9c741f18e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/wal/record/WALRecordSerializationTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/wal/record/WALRecordSerializationTest.java
@@ -21,6 +21,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.ignite.cluster.ClusterState;
 import org.apache.ignite.configuration.DataRegionConfiguration;
 import org.apache.ignite.configuration.DataStorageConfiguration;
@@ -35,7 +36,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.testframework.wal.record.RecordUtils;
 import org.junit.Test;
-import org.mockito.internal.matchers.apachecommons.ReflectionEquals;
 
 import static 
org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE;
 
@@ -96,7 +96,7 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
 
         WALRecord.RecordType[] recordTypes = WALRecord.RecordType.values();
 
-        List<ReflectionEquals> serializedRecords = new ArrayList<>();
+        List<WALRecord> serializedRecords = new ArrayList<>();
 
         IgniteWriteAheadLogManager wal = 
ignite.context().cache().context().wal();
 
@@ -106,9 +106,7 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
                 WALRecord record = RecordUtils.buildWalRecord(recordType);
 
                 if (RecordUtils.isIncludeIntoLog(record)) {
-                    serializedRecords.add(new ReflectionEquals(record, "prev", 
"pos",
-                        "updateCounter" //updateCounter for 
PartitionMetaStateRecord isn't serialized.
-                    ));
+                    serializedRecords.add(record);
 
                     wal.log(record);
                 }
@@ -123,14 +121,20 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
 
         stopGrid(0);
 
-        Iterator<ReflectionEquals> serializedIter = 
serializedRecords.iterator();
-        ReflectionEquals curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
+        Iterator<WALRecord> serializedIter = serializedRecords.iterator();
+        WALRecord curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
 
         try (WALIterator iter = wal.replay(null)) {
             while (iter.hasNext()) {
                 WALRecord record = iter.nextX().get2();
 
-                if (curExpRecord != null && curExpRecord.matches(record))
+                if (curExpRecord != null && EqualsBuilder.reflectionEquals(
+                        curExpRecord,
+                        record,
+                        "prev",
+                        "pos",
+                        "updateCounter"
+                ))
                     curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
             }
         }
@@ -151,7 +155,7 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
 
         WALRecord.RecordType[] recordTypes = WALRecord.RecordType.values();
 
-        List<ReflectionEquals> serializedRecords = new ArrayList<>();
+        List<WALRecord> serializedRecords = new ArrayList<>();
 
         IgniteWriteAheadLogManager wal = 
ignite.context().cache().context().wal();
 
@@ -164,9 +168,7 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
 
                 if (RecordUtils.isIncludeIntoLog(record) && 
(recordType.purpose() == WALRecord.RecordPurpose.LOGICAL ||
                     recordType == WALRecord.RecordType.CHECKPOINT_RECORD)) {
-                    serializedRecords.add(new ReflectionEquals(record, "prev", 
"pos",
-                        "updateCounter" //updateCounter for 
PartitionMetaStateRecord isn't serialized.
-                    ));
+                    serializedRecords.add(record);
 
                     lastPointer = wal.log(record);
                 }
@@ -204,14 +206,20 @@ public class WALRecordSerializationTest extends 
GridCommonAbstractTest {
 
         stopGrid(0);
 
-        Iterator<ReflectionEquals> serializedIter = 
serializedRecords.iterator();
-        ReflectionEquals curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
+        Iterator<WALRecord> serializedIter = serializedRecords.iterator();
+        WALRecord curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
 
         try (WALIterator iter = wal.replay(null)) {
             while (iter.hasNext()) {
                 WALRecord record = iter.nextX().get2();
 
-                if (curExpRecord != null && curExpRecord.matches(record))
+                if (curExpRecord != null && EqualsBuilder.reflectionEquals(
+                        curExpRecord,
+                        record,
+                        "prev",
+                        "pos",
+                        "updateCounter"
+                ))
                     curExpRecord = serializedIter.hasNext() ? 
serializedIter.next() : null;
             }
         }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClientSlowDiscoveryTransactionRemapTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClientSlowDiscoveryTransactionRemapTest.java
index b1c1958f61a..dfb8e99639f 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClientSlowDiscoveryTransactionRemapTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClientSlowDiscoveryTransactionRemapTest.java
@@ -18,16 +18,18 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
-import com.google.common.collect.Maps;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
@@ -43,7 +45,6 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.mockito.internal.util.collections.Sets;
 
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
@@ -126,16 +127,33 @@ public class ClientSlowDiscoveryTransactionRemapTest 
extends ClientSlowDiscovery
         tx.put(2, val + 1);
     };
 
+    /** Creates an ordered set from the given values. */
+    private static <T extends Comparable<? super T>> Set<T> sortedSetOf(T... 
vals) {
+        return new TreeSet<>(Arrays.asList(vals));
+    }
+
+    /** Creates an ordered identity map from the given set. */
+    private static <T extends Comparable<? super T>> Map<T, T> 
identitySortedMapOf(Set<T> vals) {
+        Map<T, T> res = new TreeMap<>();
+
+        for (T v : vals)
+            res.put(v, v);
+
+        return res;
+    }
+
     /** Put all remove all same keys. */
     private static IgniteInClosure<TestTransaction<Integer, Integer>> 
putAllRemoveAllSameKeys = tx -> {
-        tx.putAll(Maps.asMap(Sets.newSet(1, 2, 3, 4, 5), k -> k));
-        tx.removeAll(Sets.newSet(1, 2, 3, 4, 5));
+        Set<Integer> keys = sortedSetOf(1, 2, 3, 4, 5);
+
+        tx.putAll(identitySortedMapOf(keys));
+        tx.removeAll(keys);
     };
 
     /** Put all remove all different keys. */
     private static IgniteInClosure<TestTransaction<Integer, Integer>> 
putAllRemoveAllDifferentKeys = tx -> {
-        tx.putAll(Maps.asMap(Sets.newSet(1, 2, 3, 4, 5), k -> k));
-        tx.removeAll(Sets.newSet(6, 7, 8, 9, 10));
+        tx.putAll(identitySortedMapOf(sortedSetOf(1, 2, 3, 4, 5)));
+        tx.removeAll(sortedSetOf(6, 7, 8, 9, 10));
     };
 
     /** Random operation. */

Reply via email to