From 61ce580ebc06368c2516c9e18893772ef4aed32d Mon Sep 17 00:00:00 2001 From: Theo Kanning Date: Sun, 22 Oct 2023 15:39:26 -0500 Subject: [PATCH] Fix java 8 compilation --- .../java/com/theokanning/openai/service/FileTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/service/src/test/java/com/theokanning/openai/service/FileTest.java b/service/src/test/java/com/theokanning/openai/service/FileTest.java index 74fe2084..51dd9407 100644 --- a/service/src/test/java/com/theokanning/openai/service/FileTest.java +++ b/service/src/test/java/com/theokanning/openai/service/FileTest.java @@ -8,8 +8,9 @@ import org.junit.jupiter.api.TestMethodOrder; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Path; +import java.nio.file.Paths; import java.util.List; import java.util.concurrent.TimeUnit; @@ -21,7 +22,7 @@ public class FileTest { static String filePath = "src/test/resources/fine-tuning-data.jsonl"; String token = System.getenv("OPENAI_TOKEN"); - com.theokanning.openai.service.OpenAiService service = new OpenAiService(token); + OpenAiService service = new OpenAiService(token); static String fileId; @Test @@ -57,7 +58,8 @@ void retrieveFile() { @Order(4) void retrieveFileContent() throws IOException { String fileBytesToString = service.retrieveFileContent(fileId).string(); - assertEquals(Files.readString(Path.of(filePath)), fileBytesToString); + String contents = new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8); + assertEquals(contents, fileBytesToString); } @Test