|
|
@@ -42,7 +42,6 @@ import static org.hamcrest.Matchers.instanceOf;
|
|
|
import static org.hamcrest.Matchers.is;
|
|
|
import static org.hamcrest.Matchers.sameInstance;
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
-import static org.mockito.ArgumentMatchers.anyBoolean;
|
|
|
import static org.mockito.Mockito.doAnswer;
|
|
|
import static org.mockito.Mockito.doThrow;
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
@@ -77,7 +76,7 @@ public class RetryingHttpSenderTests extends ESTestCase {
|
|
|
Answer<InferenceServiceResults> answer = (invocation) -> inferenceResults;
|
|
|
|
|
|
var handler = mock(ResponseHandler.class);
|
|
|
- doThrow(new RetryException(true, "failed")).doNothing().when(handler).validateResponse(any(), any(), any(), any(), anyBoolean());
|
|
|
+ doThrow(new RetryException(true, "failed")).doNothing().when(handler).validateResponse(any(), any(), any(), any());
|
|
|
// Mockito.thenReturn() does not compile when returning a
|
|
|
// bounded wild card list, thenAnswer must be used instead.
|
|
|
when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
|
|
@@ -352,7 +351,7 @@ public class RetryingHttpSenderTests extends ESTestCase {
|
|
|
var handler = mock(ResponseHandler.class);
|
|
|
doThrow(new RetryException(true, "failed")).doThrow(new IllegalStateException("failed again"))
|
|
|
.when(handler)
|
|
|
- .validateResponse(any(), any(), any(), any(), anyBoolean());
|
|
|
+ .validateResponse(any(), any(), any(), any());
|
|
|
when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
|
|
|
|
|
var retrier = createRetrier(sender);
|
|
|
@@ -389,7 +388,7 @@ public class RetryingHttpSenderTests extends ESTestCase {
|
|
|
var handler = mock(ResponseHandler.class);
|
|
|
doThrow(new RetryException(true, "failed")).doThrow(new RetryException(false, "failed again"))
|
|
|
.when(handler)
|
|
|
- .validateResponse(any(), any(), any(), any(), anyBoolean());
|
|
|
+ .validateResponse(any(), any(), any(), any());
|
|
|
when(handler.parseResult(any(Request.class), any(HttpResult.class))).thenAnswer(answer);
|
|
|
|
|
|
var retrier = createRetrier(httpClient);
|
|
|
@@ -702,13 +701,8 @@ public class RetryingHttpSenderTests extends ESTestCase {
|
|
|
// testing failed requests
|
|
|
return new ResponseHandler() {
|
|
|
@Override
|
|
|
- public void validateResponse(
|
|
|
- ThrottlerManager throttlerManager,
|
|
|
- Logger logger,
|
|
|
- Request request,
|
|
|
- HttpResult result,
|
|
|
- boolean checkForErrorObject
|
|
|
- ) throws RetryException {
|
|
|
+ public void validateResponse(ThrottlerManager throttlerManager, Logger logger, Request request, HttpResult result)
|
|
|
+ throws RetryException {
|
|
|
throw new RetryException(true, new IOException("response handler validate failed as designed"));
|
|
|
}
|
|
|
|