From: David ‘Bombe’ Roden Date: Mon, 27 Sep 2021 09:36:28 +0000 (+0200) Subject: Fix test so it runs on Windows, too X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=28ad647af3d7e3f49c5ec655b3640e27293a67fc;p=Sone.git Fix test so it runs on Windows, too This also means that nobody ever tried to compile Sone on Windows. I mean, I know that _I_ didn't do it but seeing that apparently nobody else in the whole wide world has done it kinda makes me sad. Anyway, it's a simple fix. --- 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 99cf8bf..30cdc6b 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt @@ -8,7 +8,6 @@ import org.hamcrest.Matchers.* import org.junit.* import org.junit.rules.* import java.nio.file.* -import kotlin.text.Charsets.UTF_8 /** * Unit test for [ReloadingPage]. @@ -45,13 +44,14 @@ class ReloadingPageTest { @Test fun `requesting valid file results in 200 and delivers file`() { - Files.write(Paths.get(folder.path, "file.txt"), listOf("Hello", "World"), UTF_8) + val fileContent = listOf("Hello", "World").joinToString("\n", postfix = "\n") + Files.writeString(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("Hello\nWorld\n".toByteArray())) + assertThat(responseBytes.toByteArray(), equalTo(fileContent.toByteArray())) } @Test