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:
committed by
GitHub
parent
aa3f73d423
commit
1bc55a208b
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user