diff --git a/contribs/shared_mobility/src/test/java/org/matsim/contrib/shared_mobility/RunIT.java b/contribs/shared_mobility/src/test/java/org/matsim/contrib/shared_mobility/RunIT.java index 36e3a978c99..975e64b1a88 100644 --- a/contribs/shared_mobility/src/test/java/org/matsim/contrib/shared_mobility/RunIT.java +++ b/contribs/shared_mobility/src/test/java/org/matsim/contrib/shared_mobility/RunIT.java @@ -1,5 +1,6 @@ package org.matsim.contrib.shared_mobility; +import java.io.UncheckedIOException; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; diff --git a/matsim/src/test/java/org/matsim/core/controler/OutputDirectoryHierarchyTest.java b/matsim/src/test/java/org/matsim/core/controler/OutputDirectoryHierarchyTest.java index 1654d7d9e47..0431939f972 100644 --- a/matsim/src/test/java/org/matsim/core/controler/OutputDirectoryHierarchyTest.java +++ b/matsim/src/test/java/org/matsim/core/controler/OutputDirectoryHierarchyTest.java @@ -28,6 +28,7 @@ import java.io.BufferedWriter; import java.io.File; import java.io.IOException; +import java.io.UncheckedIOException; /** * @author thibautd diff --git a/matsim/src/test/java/org/matsim/core/utils/io/MatsimFileTypeGuesserTest.java b/matsim/src/test/java/org/matsim/core/utils/io/MatsimFileTypeGuesserTest.java index 8e4b7df8ff7..34b26897bd8 100644 --- a/matsim/src/test/java/org/matsim/core/utils/io/MatsimFileTypeGuesserTest.java +++ b/matsim/src/test/java/org/matsim/core/utils/io/MatsimFileTypeGuesserTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.fail; import java.io.IOException; +import java.io.UncheckedIOException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/matsim/src/test/java/org/matsim/core/utils/io/MatsimXmlParserTest.java b/matsim/src/test/java/org/matsim/core/utils/io/MatsimXmlParserTest.java index 2c7a7025d54..d7006b7ce1d 100644 --- a/matsim/src/test/java/org/matsim/core/utils/io/MatsimXmlParserTest.java +++ b/matsim/src/test/java/org/matsim/core/utils/io/MatsimXmlParserTest.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -207,7 +208,8 @@ public void endTag(String name, String content, Stack context) { }.parse(stream); Assert.fail("expected exception."); } catch (UncheckedIOException e) { - Assert.assertTrue(e.getCause() instanceof SAXParseException); // expected + Assert.assertTrue(e.getCause() instanceof IOException); // expected + Assert.assertTrue(e.getCause().getCause() instanceof SAXParseException); // expected } Assert.assertEquals(3, log.size()); @@ -282,7 +284,8 @@ public void endTag(String name, String content, Stack context) { }.parse(stream); Assert.fail("expected exception."); } catch (UncheckedIOException e) { - Assert.assertTrue(e.getCause() instanceof SAXParseException); // expected + Assert.assertTrue(e.getCause() instanceof IOException); // expected + Assert.assertTrue(e.getCause().getCause() instanceof SAXParseException); // expected } Assert.assertEquals(5, log.size()); diff --git a/matsim/src/test/java/org/matsim/testcases/MatsimTestUtils.java b/matsim/src/test/java/org/matsim/testcases/MatsimTestUtils.java index adcd07b20e3..b568268cbae 100644 --- a/matsim/src/test/java/org/matsim/testcases/MatsimTestUtils.java +++ b/matsim/src/test/java/org/matsim/testcases/MatsimTestUtils.java @@ -35,6 +35,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.UncheckedIOException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; @@ -150,7 +151,7 @@ public URL packageInputResourcePath() { private URL getResourceNotNull(String pathString) { URL resource = this.testClass.getResource(pathString); if (resource == null) { - throw new UncheckedIOException("Not found: "+pathString); + throw new UncheckedIOException(new IOException("Not found: "+pathString)); } return resource; }