From 2d1fa153f5a96d3c1dba0c38b01735bf51347a49 Mon Sep 17 00:00:00 2001 From: Sebastian Rossa Date: Fri, 15 Dec 2023 14:59:04 +0100 Subject: [PATCH] Feat(time-machine): fix tests to accept mutable vowels in file names NDISC-60 --- .../ris/norms/timemachine/TimeMachineTest.kt | 13 +++++++------ .../helper/FileToDocumentConverterTest.kt | 3 ++- .../resources/07_01_zu\303\244nderndesgesetz.xml" | 0 .../resources/07_01_\303\244nderungsgesetz.xml" | 0 4 files changed, 9 insertions(+), 7 deletions(-) rename time-machine/src/test/resources/07_01_zuaenderndesgesetz.xml => "time-machine/src/test/resources/07_01_zu\303\244nderndesgesetz.xml" (100%) rename time-machine/src/test/resources/07_01_aenderungsgesetz.xml => "time-machine/src/test/resources/07_01_\303\244nderungsgesetz.xml" (100%) diff --git a/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/TimeMachineTest.kt b/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/TimeMachineTest.kt index cb161e801..eaf8ad904 100644 --- a/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/TimeMachineTest.kt +++ b/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/TimeMachineTest.kt @@ -8,19 +8,20 @@ import org.junit.jupiter.api.Test class TimeMachineTest { private val filePathAmendingLaw = - this.javaClass.classLoader.getResource("07_01_aenderungsgesetz.xml")?.path + this.javaClass.classLoader.getResource("07_01_änderungsgesetz.xml")?.toURI() + private val fileNameToBeAmendedLaw = "07_01_zuänderndesgesetz.xml" private val filePathToBeAmendedLaw = - this.javaClass.classLoader.getResource("07_01_zuaenderndesgesetz.xml")?.path + this.javaClass.classLoader.getResource(fileNameToBeAmendedLaw)?.toURI() @Test fun `return amended law with changed text when given to-be-amended law and amending law`() { val command = TimeMachine() val workingDir = Paths.get("").toAbsolutePath().toString() - val fileNameWithoutType = - filePathToBeAmendedLaw?.substringBeforeLast(".")?.substringAfterLast("/") - val resultFromFile = File(workingDir + "/" + fileNameWithoutType + "_amended.xml") + val absolutePathResult = + workingDir + "/" + fileNameToBeAmendedLaw.substringBeforeLast(".") + "_amended.xml" + val resultFromFile = File(Paths.get(absolutePathResult).toUri()) - command.test("$filePathAmendingLaw $filePathToBeAmendedLaw") + command.test("${filePathAmendingLaw?.path} ${filePathToBeAmendedLaw?.path}") assertThat(resultFromFile).exists() assertThat(resultFromFile).isFile() diff --git a/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/helper/FileToDocumentConverterTest.kt b/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/helper/FileToDocumentConverterTest.kt index 3d753b1bd..cb3e875de 100644 --- a/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/helper/FileToDocumentConverterTest.kt +++ b/time-machine/src/test/kotlin/de/bund/digitalservice/ris/norms/timemachine/helper/FileToDocumentConverterTest.kt @@ -7,7 +7,8 @@ import org.junit.jupiter.api.Test class FileToDocumentConverterTest { - private val filePath = this.javaClass.classLoader.getResource("07_01_aenderungsgesetz.xml")?.path + private val filePath = + this.javaClass.classLoader.getResource("07_01_änderungsgesetz.xml")?.toURI() private val amendingLawFile = File(filePath!!) @Test diff --git a/time-machine/src/test/resources/07_01_zuaenderndesgesetz.xml "b/time-machine/src/test/resources/07_01_zu\303\244nderndesgesetz.xml" similarity index 100% rename from time-machine/src/test/resources/07_01_zuaenderndesgesetz.xml rename to "time-machine/src/test/resources/07_01_zu\303\244nderndesgesetz.xml" diff --git a/time-machine/src/test/resources/07_01_aenderungsgesetz.xml "b/time-machine/src/test/resources/07_01_\303\244nderungsgesetz.xml" similarity index 100% rename from time-machine/src/test/resources/07_01_aenderungsgesetz.xml rename to "time-machine/src/test/resources/07_01_\303\244nderungsgesetz.xml"