From 505248a8b80721757ec34e484ddeeb099264f06f Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Wed, 18 Feb 2026 21:46:36 +0000
Subject: [PATCH 1/2] chore(deps-dev): Bump org.mockito:mockito-core from
4.11.0 to 5.21.0
Bumps `mockito-core` from 4.11.0 to 5.21.0.
Updates `maven-compiler-plugin` configuration to use Java 11 for test compilation, as Mockito 5 requires Java 11+.
Replaces deprecated `MockitoAnnotations.initMocks` with `MockitoAnnotations.openMocks` in `MockitoTestRule.java` and ensures the returned `AutoCloseable` is closed.
Co-authored-by: lahirumaramba <55609+lahirumaramba@users.noreply.github.com>
---
pom.xml | 15 ++++++++++++++-
.../google/firebase/testing/MockitoTestRule.java | 3 ++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index e51fbdabd..08fe6fa1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -268,6 +268,19 @@
1.8
1.8
+
+
+ default-testCompile
+ test-compile
+
+ testCompile
+
+
+ 11
+ 11
+
+
+
@@ -451,7 +464,7 @@
org.mockito
mockito-core
- 4.11.0
+ 5.21.0
test
diff --git a/src/test/java/com/google/firebase/testing/MockitoTestRule.java b/src/test/java/com/google/firebase/testing/MockitoTestRule.java
index 99edaed42..8b87bd20b 100644
--- a/src/test/java/com/google/firebase/testing/MockitoTestRule.java
+++ b/src/test/java/com/google/firebase/testing/MockitoTestRule.java
@@ -33,11 +33,12 @@ public Statement apply(final Statement base, FrameworkMethod method, final Objec
return new Statement() {
@Override
public void evaluate() throws Throwable {
- MockitoAnnotations.initMocks(target);
+ AutoCloseable closeable = MockitoAnnotations.openMocks(target);
try {
base.evaluate();
} finally {
Mockito.validateMockitoUsage();
+ closeable.close();
}
}
};
From 4f691cecdda0d6b89d28ad950c407a6bbbf3e56e Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Wed, 18 Feb 2026 21:52:41 +0000
Subject: [PATCH 2/2] chore(deps-dev): Bump org.mockito:mockito-core from
4.11.0 to 5.21.0
Bumps `mockito-core` from 4.11.0 to 5.21.0 on JDK 11+.
Keeps `mockito-core` at 4.11.0 for JDK 8 builds to maintain compatibility.
Uses a Maven profile `mockito-5-jdk-11` to conditionally apply the upgrade and set test compilation target to 11 when running on JDK 11 or higher.
Replaces deprecated `MockitoAnnotations.initMocks` with `MockitoAnnotations.openMocks` in `MockitoTestRule.java` and ensures the returned `AutoCloseable` is closed, which is compatible with both Mockito 4 and 5.
Co-authored-by: lahirumaramba <55609+lahirumaramba@users.noreply.github.com>
---
pom.xml | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/pom.xml b/pom.xml
index 08fe6fa1c..a04cec4cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,6 +70,41 @@
+
+ mockito-5-jdk-11
+
+ [11,)
+
+
+
+ org.mockito
+ mockito-core
+ 5.21.0
+ test
+
+
+
+
+
+ maven-compiler-plugin
+ 3.15.0
+
+
+ default-testCompile
+ test-compile
+
+ testCompile
+
+
+ 11
+ 11
+
+
+
+
+
+
+
devsite-apidocs
@@ -268,19 +303,6 @@
1.8
1.8
-
-
- default-testCompile
- test-compile
-
- testCompile
-
-
- 11
- 11
-
-
-
@@ -464,7 +486,7 @@
org.mockito
mockito-core
- 5.21.0
+ 4.11.0
test