Skip to content

Commit 4b773f9

Browse files
committed
test(bigtable): remove unnecessary deep stubs from streaming callable mocks
Remove `defaultAnswer(Answers.RETURNS_DEEP_STUBS)` from programmatic mocks of `ServerStreamingCallable` in `BigtableDataClientTests`. Mockito's deep stubs cause reflection crashes on Java 8 when dealing with JSpecify annotations. Since the tests do not rely on deep stubs for these callables, they can be safely removed. TAG=agy CONV=de3ef09d-a26c-4190-b578-4c993f807bdc
1 parent cfca7f4 commit 4b773f9

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

‎java-bigtable/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTests.java‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ public void setUp() {
105105
mockStub =
106106
Mockito.mock(EnhancedBigtableStub.class, Mockito.withSettings().withoutAnnotations());
107107
mockReadRowsCallable =
108-
Mockito.mock(
109-
ServerStreamingCallable.class,
110-
Mockito.withSettings().withoutAnnotations().defaultAnswer(Answers.RETURNS_DEEP_STUBS));
108+
Mockito.mock(ServerStreamingCallable.class, Mockito.withSettings().withoutAnnotations());
111109
mockReadRowCallable =
112110
Mockito.mock(UnaryCallable.class, Mockito.withSettings().withoutAnnotations());
113111
mockSampleRowKeysCallable =
@@ -129,13 +127,9 @@ public void setUp() {
129127
mockPrepareQueryCallable =
130128
Mockito.mock(UnaryCallable.class, Mockito.withSettings().withoutAnnotations());
131129
mockGenerateInitialChangeStreamPartitionsCallable =
132-
Mockito.mock(
133-
ServerStreamingCallable.class,
134-
Mockito.withSettings().withoutAnnotations().defaultAnswer(Answers.RETURNS_DEEP_STUBS));
130+
Mockito.mock(ServerStreamingCallable.class, Mockito.withSettings().withoutAnnotations());
135131
mockReadChangeStreamCallable =
136-
Mockito.mock(
137-
ServerStreamingCallable.class,
138-
Mockito.withSettings().withoutAnnotations().defaultAnswer(Answers.RETURNS_DEEP_STUBS));
132+
Mockito.mock(ServerStreamingCallable.class, Mockito.withSettings().withoutAnnotations());
139133

140134
bigtableDataClient = new BigtableDataClient(mockStub);
141135
}

0 commit comments

Comments
 (0)