|
27 | 27 | import static org.mockito.Mockito.any;
|
28 | 28 | import static org.mockito.Mockito.anyInt;
|
29 | 29 | import static org.mockito.Mockito.doReturn;
|
30 |
| -import static org.mockito.Mockito.doThrow; |
31 | 30 | import static org.mockito.Mockito.mock;
|
32 | 31 | import static org.mockito.Mockito.never;
|
33 | 32 | import static org.mockito.Mockito.reset;
|
|
71 | 70 | import org.junit.jupiter.params.ParameterizedTest;
|
72 | 71 | import org.junit.jupiter.params.provider.Arguments;
|
73 | 72 | import org.junit.jupiter.params.provider.MethodSource;
|
| 73 | +import org.mockito.stubbing.OngoingStubbing; |
74 | 74 | import org.slf4j.event.Level;
|
75 | 75 |
|
76 | 76 | /**
|
@@ -353,9 +353,11 @@ private static Stream<Arguments> exceptionsNotTriggerRefresh() {
|
353 | 353 | private static ChunkInputStream throwingChunkInputStream(IOException ex,
|
354 | 354 | int len, boolean succeedOnRetry) throws IOException {
|
355 | 355 | final ChunkInputStream stream = mock(ChunkInputStream.class);
|
356 |
| - doThrow(ex).doReturn(len).when(stream.read(any(), anyInt(), anyInt())); |
| 356 | + OngoingStubbing<Integer> stubbing = |
| 357 | + when(stream.read(any(), anyInt(), anyInt())) |
| 358 | + .thenThrow(ex); |
357 | 359 | if (succeedOnRetry) {
|
358 |
| - doReturn(len).when(stream).read(any(), anyInt(), anyInt()); |
| 360 | + stubbing.thenReturn(len); |
359 | 361 | }
|
360 | 362 | doReturn((long) len).when(stream.getRemaining());
|
361 | 363 | return stream;
|
|
0 commit comments