diff --git a/.gitignore b/.gitignore index f190e4bc19841cf1aa289fc09f5b260ea70f0b82..eb2353e6a5bbacc39950c1f4c8d831003d13c863 100644 --- a/.gitignore +++ b/.gitignore @@ -272,3 +272,4 @@ $RECYCLE.BIN/ *.lnk # End of https://www.gitignore.io/api/java,maven,macos,linux,eclipse,windows,netbeans,intellij +/- diff --git a/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java b/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java index b5b3584782ca9e1754ffa8f1109a7cca32942a22..4fec364f0692948da77cbfb2eaf6b158bedc6928 100644 --- a/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java +++ b/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java @@ -113,6 +113,21 @@ void testExtractRegionWithStandardInput() throws IOException { assertEquals(2, countBuildings(outGML)); } + @Test + void testExtractRegionWithStandardInputAndStandardOutput() throws IOException { + String wktPolygon = "POLYGON((-73.9959209576448 40.73286384885367, -73.996317924579 40.732359794090684, -73.9947515145143 40.7315061442504, -73.99422580154739 40.73214841515045, -73.9959209576448 40.73286384885367))"; + Path citygml = TEST_REPOSITORY.resolve("NewYork.proj/ManhattanSmall.gml"); + InputStream stdin = new ByteArrayInputStream(wktPolygon.getBytes(StandardCharsets.UTF_8)); + System.setIn(stdin); + new CommandLine(new RegionChooserCommandLineInterface()).execute("--input=" + citygml, "--output=-", "--wkt=-"); + String expectedLog = "EPSG:32118"; + assertTrue(err.toString().contains(expectedLog), err.toString() + " should contain " + expectedLog); + originalOut.println(err.toString()); + originalOut.println("--------------------"); + originalOut.println(out.toString()); + assertFalse(Files.exists(Paths.get("-"))); + } + @Test void testExtractRegionWithMissingInput() throws IOException { String wktPolygon = "POLYGON((-73.9959209576448 40.73286384885367, -73.996317924579 40.732359794090684, -73.9947515145143 40.7315061442504, -73.99422580154739 40.73214841515045, -73.9959209576448 40.73286384885367))";