From 696f04f86e53b01a3e9c3b468c876956a72ff1ec Mon Sep 17 00:00:00 2001 From: Lars Ivar Hatledal Date: Wed, 23 Mar 2022 20:35:08 +0100 Subject: [PATCH] Fix tests on paths with spaces --- .../ais/fmu4j/modeldescription/fmi1/TestVesselFmu.java | 5 +++-- .../modeldescription/fmi2/TestTrajectoryController.java | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi1/TestVesselFmu.java b/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi1/TestVesselFmu.java index a5cac10..049e9f2 100644 --- a/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi1/TestVesselFmu.java +++ b/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi1/TestVesselFmu.java @@ -11,8 +11,9 @@ public class TestVesselFmu { @Test public void testVesselFmu() throws IOException { - File xmlFile = new File(TestVesselFmu.class.getClassLoader() - .getResource("fmi1.0/VesselFmu/modelDescription.xml").getFile()); + String file = TestVesselFmu.class.getClassLoader() + .getResource("fmi1.0/VesselFmu/modelDescription.xml").getFile(); + File xmlFile = new File(file.replace("%20", " ")); FmiModelDescription md = FmiModelDescription.fromXml(xmlFile); diff --git a/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi2/TestTrajectoryController.java b/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi2/TestTrajectoryController.java index bd4911b..3d1c324 100644 --- a/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi2/TestTrajectoryController.java +++ b/fmi-export/src/test/java/no/ntnu/ais/fmu4j/modeldescription/fmi2/TestTrajectoryController.java @@ -1,6 +1,6 @@ package no.ntnu.ais.fmu4j.modeldescription.fmi2; -import no.ntnu.ais.fmu4j.modeldescription.fmi1.TestVesselFmu; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.io.File; @@ -10,10 +10,12 @@ public class TestTrajectoryController { @Test public void test() throws IOException { - File xmlFile = new File(TestVesselFmu.class.getClassLoader() - .getResource("fmi2.0/TrajectoryController/modelDescription.xml").getFile()); + String file = TestTrajectoryController.class.getClassLoader() + .getResource("fmi2.0/TrajectoryController/modelDescription.xml").getFile(); + File xmlFile = new File(file.replace("%20", " ")); Fmi2ModelDescription md = Fmi2ModelDescription.fromXml(xmlFile); + Assertions.assertEquals(md.getModelName(), "TrajectoryController"); } }