Commit 83d927c6 authored by Eric Duminil's avatar Eric Duminil
Browse files

More test

parent 386b7a16
......@@ -46,7 +46,6 @@ class RegionChooserCommandLineInterface implements Callable<Integer>
@Override
public Integer call() throws Exception {
//TODO: Test
CoordinateReferenceSystem localCRS;
if (espgId == null) {
......
......@@ -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
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment