Commit 13964f2
authored
test(bigtable): disable deep stub answers causing Java 8 Mockito reflection crash (#13831)
### Problem
In JSpecify 1.0.0, the `@NullMarked` annotation targets
`ElementType.MODULE`. Because `ElementType.MODULE` was introduced in
Java 9, reflecting on `@NullMarked` classes under Java 8 (JDK 1.8)
throws `EnumConstantNotPresentExceptionProxy` wrapped in an
`ArrayStoreException`.
In `BigtableDataClientTests`, Mockito's mock declarations for
`ServerStreamingCallable` were configured with `answer =
Answers.RETURNS_DEEP_STUBS`. When Mockito generates deep stubs, it
dynamically reflects on the return type to build intermediate mocks,
triggering this reflection crash on `@NullMarked` classes under Java 8
CI pipelines.
### Solution
Since the tests do not actually call or rely on deep stubs for these
streaming callables, we can safely remove `(answer =
Answers.RETURNS_DEEP_STUBS)`. Removing deep stubs prevents Mockito from
performing the reflection that causes the Java 8 pipeline crash,
allowing the test suite to execute successfully.1 parent 562a391 commit 13964f2
1 file changed
Lines changed: 3 additions & 5 deletions
File tree
- java-bigtable/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
99 | | - | |
| 97 | + | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
103 | | - | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
0 commit comments