diff --git a/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java b/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java index 7dd29e3afadfcb81e23da0a420a55f3a7fa32b69..1589440de29aa6f97e7571687400888c35f295dd 100644 --- a/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java +++ b/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java @@ -46,7 +46,6 @@ class RegionChooserCommandLineInterface implements Callable<Integer> @Override public Integer call() throws Exception { - //TODO: Test CoordinateReferenceSystem localCRS; if (espgId == null) { diff --git a/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java b/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java index dd61dcf5ceacda200e82a90d9d21160eefbb818f..6ca78b805f95d6105fbb68f183f94bade0de7818 100644 --- a/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java +++ b/src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java @@ -40,7 +40,7 @@ public void restoreStreams() { @Test void testNoInput() { new CommandLine(new RegionChooserCommandLineInterface()).execute(""); - originalOut.println(err.toString()); + // originalOut.println(err.toString()); String expectedErr = "Missing required options: '--input=input.gml', '--output=output.gml', '--wkt=polygon.wkt'"; assertTrue(err.toString().contains(expectedErr), err.toString() + " should contain " + expectedErr); } @@ -57,10 +57,31 @@ void testExtractRegionFromTwoCitygmls() throws IOException { } new CommandLine(new RegionChooserCommandLineInterface()).execute("--input=" + citygml1 + "," + citygml2, "--output=" + outGML, "--wkt=" + inWKT, "--epsg=31463", "--local"); - String expectedErr = "Buildings found in selected region 20"; - assertTrue(err.toString().contains(expectedErr), err.toString() + " should contain " + expectedErr); - originalOut.println(Files.size(outGML)); + String expectedLog = "Buildings found in selected region 20"; + assertTrue(err.toString().contains(expectedLog), err.toString() + " should contain " + expectedLog); assertTrue(Files.size(outGML) > 600_000); } + + + @Test + void testExtractRegionFromTwoCitygmlsInWGS84() throws IOException { + String wktPolygon = "POLYGON((9.18991539528286 48.79067456353269, 9.195580220722313 48.7873947720947, 9.172062612079735 48.78241812742368, 9.170946813129538 48.78569824412753, 9.18991539528286 48.79067456353269))"; + Path citygml1 = TEST_REPOSITORY.resolve("Stuttgart.proj/Stuttgart_LOD0_LOD1_small.gml"); + Path citygml2 = TEST_REPOSITORY.resolve("Stuttgart.proj/Stöckach_überarbeitete GML-NoBuildingPart.gml"); + Path outGML = Files.createTempFile("output", ".gml"); + Path inWKT = Files.createTempFile("polygon", ".wkt"); + try (BufferedWriter wkt = Files.newBufferedWriter(inWKT)) { + wkt.write(wktPolygon); + } + new CommandLine(new RegionChooserCommandLineInterface()).execute("--input=" + citygml1 + "," + citygml2, + "--output=" + outGML, "--wkt=" + inWKT); + originalOut.println(err.toString()); + String expectedLog = "EPSG:31463"; + assertTrue(err.toString().contains(expectedLog), err.toString() + " should contain " + expectedLog); + expectedLog = "Buildings found in selected region 22"; + assertTrue(err.toString().contains(expectedLog), err.toString() + " should contain " + expectedLog); + assertTrue(Files.size(outGML) > 300_000); + } + //TODO: Test with stdin }