|
42 | 42 | import static org.hamcrest.Matchers.is;
|
43 | 43 | import static org.hamcrest.Matchers.sameInstance;
|
44 | 44 | import static org.mockito.ArgumentMatchers.any;
|
| 45 | +import static org.mockito.ArgumentMatchers.anyBoolean; |
45 | 46 | import static org.mockito.Mockito.doAnswer;
|
46 | 47 | import static org.mockito.Mockito.doThrow;
|
47 | 48 | import static org.mockito.Mockito.mock;
|
@@ -76,7 +77,7 @@ public void testSend_CallsSenderAgain_AfterValidateResponseThrowsAnException() t
|
76 | 77 | Answer<InferenceServiceResults> answer = (invocation) -> inferenceResults;
|
77 | 78 |
|
78 | 79 | var handler = mock(ResponseHandler.class);
|
79 |
| - doThrow(new RetryException(true, "failed")).doNothing().when(handler).validateResponse(any(), any(), any(), any()); |
| 80 | + doThrow(new RetryException(true, "failed")).doNothing().when(handler).validateResponse(any(), any(), any(), any(), anyBoolean()); |
80 | 81 | // Mockito.thenReturn() does not compile when returning a
|
81 | 82 | // bounded wild card list, thenAnswer must be used instead.
|
82 | 83 | when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
@@ -351,7 +352,7 @@ public void testSend_ReturnsFailure_WhenValidateResponseThrowsAnException_AfterO
|
351 | 352 | var handler = mock(ResponseHandler.class);
|
352 | 353 | doThrow(new RetryException(true, "failed")).doThrow(new IllegalStateException("failed again"))
|
353 | 354 | .when(handler)
|
354 |
| - .validateResponse(any(), any(), any(), any()); |
| 355 | + .validateResponse(any(), any(), any(), any(), anyBoolean()); |
355 | 356 | when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
356 | 357 |
|
357 | 358 | var retrier = createRetrier(sender);
|
@@ -388,7 +389,7 @@ public void testSend_ReturnsFailure_WhenValidateResponseThrowsAnElasticsearchExc
|
388 | 389 | var handler = mock(ResponseHandler.class);
|
389 | 390 | doThrow(new RetryException(true, "failed")).doThrow(new RetryException(false, "failed again"))
|
390 | 391 | .when(handler)
|
391 |
| - .validateResponse(any(), any(), any(), any()); |
| 392 | + .validateResponse(any(), any(), any(), any(), anyBoolean()); |
392 | 393 | when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
393 | 394 |
|
394 | 395 | var retrier = createRetrier(httpClient);
|
@@ -701,8 +702,13 @@ private ResponseHandler createRetryingResponseHandler() {
|
701 | 702 | // testing failed requests
|
702 | 703 | return new ResponseHandler() {
|
703 | 704 | @Override
|
704 |
| - public void validateResponse(ThrottlerManager throttlerManager, Logger logger, Request request, HttpResult result) |
705 |
| - throws RetryException { |
| 705 | + public void validateResponse( |
| 706 | + ThrottlerManager throttlerManager, |
| 707 | + Logger logger, |
| 708 | + Request request, |
| 709 | + HttpResult result, |
| 710 | + boolean checkForErrorObject |
| 711 | + ) throws RetryException { |
706 | 712 | throw new RetryException(true, new IOException("response handler validate failed as designed"));
|
707 | 713 | }
|
708 | 714 |
|
|
0 commit comments