Use ByteArrayOutputStream.toString where possible
See gh-32534
This commit is contained in:
committed by
Stephane Nicoll
parent
a036b30822
commit
65ef8fc51a
@@ -316,7 +316,7 @@ class HttpClientTransportTests {
|
||||
private String writeToString(HttpEntity entity) throws IOException {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
entity.writeTo(out);
|
||||
return new String(out.toByteArray(), StandardCharsets.UTF_8);
|
||||
return out.toString(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private void givenClientWillReturnResponse() throws IOException {
|
||||
|
||||
@@ -65,7 +65,7 @@ class ContainerConfigTests extends AbstractJsonTests {
|
||||
});
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
containerConfig.writeTo(outputStream);
|
||||
String actualJson = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
|
||||
String actualJson = outputStream.toString(StandardCharsets.UTF_8);
|
||||
String expectedJson = StreamUtils.copyToString(getContent("container-config.json"), StandardCharsets.UTF_8);
|
||||
JSONAssert.assertEquals(expectedJson, actualJson, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user