Unchecked-Warnungen in AI-Tests bereinigt
This commit is contained in:
@@ -115,9 +115,7 @@ class AnthropicClaudeAdapterIntegrationTest {
|
||||
+ "\"stop_reason\":\"end_turn\""
|
||||
+ "}";
|
||||
|
||||
HttpResponse<String> mockHttpResponse = mock(HttpResponse.class);
|
||||
when(mockHttpResponse.statusCode()).thenReturn(200);
|
||||
when(mockHttpResponse.body()).thenReturn(anthropicResponseBody);
|
||||
HttpResponse<String> mockHttpResponse = mockStringResponse(200, anthropicResponseBody);
|
||||
doReturn(mockHttpResponse).when(mockHttpClient).send(any(HttpRequest.class), any());
|
||||
|
||||
// --- Create the Claude adapter with the mocked HTTP client ---
|
||||
@@ -178,6 +176,19 @@ class AnthropicClaudeAdapterIntegrationTest {
|
||||
// Helpers
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* Creates a typed mock {@link HttpResponse} to avoid unchecked-cast warnings at call sites.
|
||||
* The suppression is confined to this helper because the raw-type cast is technically
|
||||
* unavoidable due to type erasure when mocking generic interfaces.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static HttpResponse<String> mockStringResponse(int statusCode, String body) {
|
||||
HttpResponse<String> response = (HttpResponse<String>) mock(HttpResponse.class);
|
||||
when(response.statusCode()).thenReturn(statusCode);
|
||||
when(response.body()).thenReturn(body);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single-page searchable PDF with embedded text using PDFBox.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user