From f905fcb212ae9bc2b6c6ab169f2398defcdd088b Mon Sep 17 00:00:00 2001 From: Nicole Lee Date: Mon, 20 Jul 2026 04:45:35 +0000 Subject: [PATCH 1/2] test(storage-nio): disable copying annotations on Page mocks for Java 8 compatibility --- .../storage/contrib/nio/CloudStorageIsDirectoryTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java b/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java index e78d6859de6f..6cfd4dd17c34 100644 --- a/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java +++ b/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java @@ -69,7 +69,7 @@ public void testIsDirectoryNoUserProject() { CloudStorageFileSystem.forBucket("bucket", CloudStorageConfiguration.DEFAULT, mockOptions); when(mockStorage.get(BlobId.of("bucket", "test", null))) .thenThrow(new IllegalArgumentException()); - Page pages = mock(Page.class); + Page pages = Mockito.mock(Page.class, Mockito.withSettings().withoutAnnotations()); Blob blob = mock(Blob.class); when(blob.getBlobId()).thenReturn(BlobId.of("bucket", "test/hello.txt")); when(pages.getValues()).thenReturn(Lists.newArrayList(blob)); @@ -91,7 +91,7 @@ public void testIsDirectoryWithUserProject() { mockOptions); when(mockStorage.get(BlobId.of("bucket", "test", null))) .thenThrow(new IllegalArgumentException()); - Page pages = mock(Page.class); + Page pages = Mockito.mock(Page.class, Mockito.withSettings().withoutAnnotations()); Blob blob = mock(Blob.class); when(blob.getBlobId()).thenReturn(BlobId.of("bucket", "test/hello.txt")); when(pages.getValues()).thenReturn(Lists.newArrayList(blob)); From bbe3c8af8a7adc5569ab93df1d9783f0786912f5 Mon Sep 17 00:00:00 2001 From: Nicole Lee Date: Mon, 20 Jul 2026 04:55:17 +0000 Subject: [PATCH 2/2] test(storage-nio): added import mockito --- .../cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java b/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java index 6cfd4dd17c34..a2662debf0fe 100644 --- a/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java +++ b/java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageIsDirectoryTest.java @@ -36,6 +36,7 @@ import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import org.mockito.Mockito; /** Unit tests for {@code Files.isDirectory()}. */ @RunWith(JUnit4.class)