Removed usage to IOUtils.toString (#8579)

Specifically the toString reading from inputstream.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp
2020-09-25 20:46:14 +02:00
committed by GitHub
parent aa3f73d423
commit 1bc55a208b
13 changed files with 46 additions and 43 deletions

View File

@@ -16,9 +16,9 @@ import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.openhab.binding.foobot.internal.FoobotApiConnector;
@@ -38,7 +38,7 @@ public class FoobotAccountHandlerTest {
@Override
protected String request(String url, String apiKey) throws FoobotApiException {
try (InputStream stream = getClass().getResourceAsStream("../devices.json")) {
return IOUtils.toString(stream);
return new String(stream.readAllBytes(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new AssertionError(e.getMessage());
}

View File

@@ -16,8 +16,8 @@ import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.openhab.binding.foobot.internal.FoobotApiConnector;
@@ -40,7 +40,7 @@ public class FoobotDeviceHandlerTest {
@Override
protected String request(String url, String apiKey) throws FoobotApiException {
try (InputStream stream = getClass().getResourceAsStream("../sensors.json")) {
return IOUtils.toString(stream);
return new String(stream.readAllBytes(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new AssertionError(e.getMessage());
}