From: David ‘Bombe’ Roden Date: Mon, 27 Sep 2021 11:03:39 +0000 (+0200) Subject: Make test work with Java 8, too X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bfaaa6079966860b840f01cba4e83dc6e1cff947;p=Sone.git Make test work with Java 8, too Because the Files.writeString method was only added in Java 11 but I still want Sone to be compilable and runnable with Java 8 because a) it's what I still use (yes, I'm proper ashamed) and b) it's probably what many other people still use as long as Freenet doesn't bundle its own Java (which it really should). --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt index 30cdc6b..6470c95 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt @@ -44,14 +44,14 @@ class ReloadingPageTest { @Test fun `requesting valid file results in 200 and delivers file`() { - val fileContent = listOf("Hello", "World").joinToString("\n", postfix = "\n") - Files.writeString(Paths.get(folder.path, "file.txt"), fileContent) + val fileContent = listOf("Hello", "World").joinToString("\n", postfix = "\n").toByteArray() + Files.write(Paths.get(folder.path, "file.txt"), fileContent) webPageTest.request("/prefix/path/file.txt") page.handleRequest(freenetRequest, response) assertThat(response.statusCode, equalTo(200)) assertThat(response.statusText, equalTo("OK")) assertThat(response.contentType, equalTo("text/plain")) - assertThat(responseBytes.toByteArray(), equalTo(fileContent.toByteArray())) + assertThat(responseBytes.toByteArray(), equalTo(fileContent)) } @Test