Skip to content

Commit aed3f1f

Browse files
committed
fixed test
1 parent 929d77e commit aed3f1f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,8 +3533,9 @@ public void callNativeServiceWithEmptyResponseSync() throws IOException {
35333533
assertNotNull(apiFile);
35343534

35353535
JavaFileAssert.assertThat(apiFile).fileContains(
3536-
//reading the body into a string, then checking if it is blank.
3537-
"String responseBody = new String(localVarResponse.body().readAllBytes());",
3536+
// reading the body into a string after decompression, then checking if it is blank.
3537+
"localVarResponseBody = ApiClient.getResponseBody(localVarResponse);",
3538+
"String responseBody = new String(localVarResponseBody.readAllBytes());",
35383539
"responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<LocationData>() {})"
35393540
);
35403541
}
@@ -3627,9 +3628,10 @@ public void callNativeServiceWithEmptyResponseAsync() throws IOException {
36273628
File apiFile = files.get("DefaultApi.java");
36283629
assertNotNull(apiFile);
36293630

3630-
JavaFileAssert.assertThat(apiFile).fileDoesNotContain(
3631-
//reading the body into a string, then checking if it is blank.
3632-
"String responseBody = new String(localVarResponse.body().readAllBytes());",
3631+
JavaFileAssert.assertThat(apiFile).fileContains(
3632+
// async path should also decompress before reading the body.
3633+
"InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse);",
3634+
"String responseBody = new String(localVarResponseBody.readAllBytes());",
36333635
"responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<LocationData>() {})"
36343636
);
36353637
}

0 commit comments

Comments
 (0)