From ecef64dbcc7942859daf7cf26b62e5a389b3dcc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:03:24 +0000 Subject: [PATCH 1/2] build(deps-dev): bump org.mockito:mockito-core from 4.11.0 to 5.0.0 Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 4.11.0 to 5.0.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v4.11.0...v5.0.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-version: 5.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 14779f57c..a9dfa628a 100644 --- a/pom.xml +++ b/pom.xml @@ -253,7 +253,7 @@ org.mockito mockito-core - 4.11.0 + 5.0.0 test From af474317a6b95ee28c646c730b9000fe6296ac53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Sun, 14 Jun 2026 10:29:04 +0200 Subject: [PATCH 2/2] test: update tests to support mockito 5.x --- pom.xml | 16 ++++++++++++++-- .../spanner/pgadapter/ConnectionHandlerTest.java | 4 +--- .../spanner/pgadapter/JdbcMockServerTest.java | 3 ++- .../pgadapter/utils/MutationWriterTest.java | 16 ++++++++++++---- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index a9dfa628a..a4ae697fb 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,8 @@ 2.10.1 0.36.0 + mockito-core + 4.11.0 4.0.0 @@ -252,8 +254,8 @@ org.mockito - mockito-core - 5.0.0 + ${mockito.artifactId} + ${mockito.version} test @@ -409,6 +411,16 @@ + + mockito-jdk11plus + + [9,) + + + mockito-subclass + 5.14.2 + + diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/ConnectionHandlerTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/ConnectionHandlerTest.java index efa5cd84c..b1e0d5fc3 100644 --- a/src/test/java/com/google/cloud/spanner/pgadapter/ConnectionHandlerTest.java +++ b/src/test/java/com/google/cloud/spanner/pgadapter/ConnectionHandlerTest.java @@ -27,8 +27,6 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -908,7 +906,7 @@ public void testListDatabasesOrInstances() { Spanner spanner = mock(Spanner.class); DatabaseAdminClient adminClient = mock(DatabaseAdminClient.class); when(spanner.getDatabaseAdminClient()).thenReturn(adminClient); - when(adminClient.listDatabases(eq("my-instance"), any())).thenReturn(Pages.empty()); + when(adminClient.listDatabases("my-instance")).thenReturn(Pages.empty()); StatusRuntimeException exception = newStatusResourceNotFoundException( "test-database", diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/JdbcMockServerTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/JdbcMockServerTest.java index 8171e7313..9d9f18369 100644 --- a/src/test/java/com/google/cloud/spanner/pgadapter/JdbcMockServerTest.java +++ b/src/test/java/com/google/cloud/spanner/pgadapter/JdbcMockServerTest.java @@ -4552,7 +4552,8 @@ public void testSetTimeZoneEST() throws SQLException { try (Connection connection = DriverManager.getConnection(createUrl())) { // Java considers 'EST' to always be '-05:00'. That is; it is never DST. connection.createStatement().execute("set time zone 'EST'"); - verifySettingValue(connection, "timezone", "-05:00"); + verifySettingValue( + connection, "timezone", java.time.ZoneId.SHORT_IDS.getOrDefault("EST", "-05:00")); // 'EST5EDT' is the ID for the timezone that will change with DST. connection.createStatement().execute("set time zone 'EST5EDT'"); verifySettingValue(connection, "timezone", "EST5EDT"); diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/utils/MutationWriterTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/utils/MutationWriterTest.java index 5c8a97af7..8142b99b0 100644 --- a/src/test/java/com/google/cloud/spanner/pgadapter/utils/MutationWriterTest.java +++ b/src/test/java/com/google/cloud/spanner/pgadapter/utils/MutationWriterTest.java @@ -170,7 +170,9 @@ public void testWriteMutations() throws Exception { .set("name") .to("Two") .build()); - verify(databaseClient).writeWithOptions(eq(expectedMutations), any()); + verify(databaseClient) + .writeWithOptions( + eq(expectedMutations), any(com.google.cloud.spanner.Options.TransactionOption[].class)); } @Test @@ -270,7 +272,9 @@ public void testWriteMutations_NonAtomic_SucceedsForLargeBatch() throws Exceptio StatementResult updateCount = mutationWriter.call(); assertEquals(5L, updateCount.getUpdateCount().longValue()); - verify(databaseClient, times(3)).writeWithOptions(anyIterable(), any()); + verify(databaseClient, times(3)) + .writeWithOptions( + anyIterable(), any(com.google.cloud.spanner.Options.TransactionOption[].class)); } finally { System.getProperties().remove("copy_in_mutation_limit"); } @@ -372,7 +376,9 @@ public void testWriteMutations_NonAtomic_SucceedsForLargeCommit() throws Excepti // 4. The second batch contains 28 bytes. (3 - 'Three') // 5. The third batch contains 24 bytes. (4 - 'Four') // 6. the fourth batch contains 24 bytes. (5 - 'Five') - verify(databaseClient, times(4)).writeWithOptions(anyIterable(), any()); + verify(databaseClient, times(4)) + .writeWithOptions( + anyIterable(), any(com.google.cloud.spanner.Options.TransactionOption[].class)); } finally { System.getProperties().remove("copy_in_commit_limit"); } @@ -441,7 +447,9 @@ public void testWritePartials() throws Exception { .set("name") .to("Five") .build()); - verify(databaseClient).writeWithOptions(eq(expectedMutations), any()); + verify(databaseClient) + .writeWithOptions( + eq(expectedMutations), any(com.google.cloud.spanner.Options.TransactionOption[].class)); executor.shutdown(); }