From 0c590c68e6d19730d250beb28b02f011ffdc570c Mon Sep 17 00:00:00 2001 From: lolodomo Date: Tue, 23 Jun 2020 18:23:36 +0200 Subject: [PATCH] [sleepiq] Fix the failing tests on Windows (#7983) Signed-off-by: Laurent Garnier --- .../binding/sleepiq/api/test/AbstractTest.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bundles/org.openhab.binding.sleepiq/src/3rdparty/test/org/openhab/binding/sleepiq/api/test/AbstractTest.java b/bundles/org.openhab.binding.sleepiq/src/3rdparty/test/org/openhab/binding/sleepiq/api/test/AbstractTest.java index f9dfd395b565c..955f7e2ef86b4 100644 --- a/bundles/org.openhab.binding.sleepiq/src/3rdparty/test/org/openhab/binding/sleepiq/api/test/AbstractTest.java +++ b/bundles/org.openhab.binding.sleepiq/src/3rdparty/test/org/openhab/binding/sleepiq/api/test/AbstractTest.java @@ -24,17 +24,14 @@ import java.util.Arrays; import java.util.List; -public abstract class AbstractTest -{ +public abstract class AbstractTest { private static final String RESOURCES_PATH = "src/test/resources/"; - protected File getTestDataFile(String name) - { + protected File getTestDataFile(String name) { return getTestDataPath(name).toFile(); } - protected Path getTestDataPath(String name) - { + protected Path getTestDataPath(String name) { String packageName = this.getClass().getPackage().getName(); List paths = new ArrayList<>(); @@ -44,8 +41,7 @@ protected Path getTestDataPath(String name) return Paths.get(RESOURCES_PATH, paths.toArray(new String[paths.size()])); } - protected String readJson(String jsonFileName) throws IOException - { - return new String(Files.readAllBytes(getTestDataPath(jsonFileName))); + protected String readJson(String jsonFileName) throws IOException { + return String.join("\n", Files.readAllLines(getTestDataPath(jsonFileName))); } }