Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
04a18c6b
Commit
04a18c6b
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Fixed tests.
parent
2e12ddb8
master
develop
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java
+13
-9
.../regionchooser/RegionChooserCommandLineInterfaceTest.java
with
13 additions
and
9 deletions
+13
-9
src/test/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterfaceTest.java
+
13
-
9
View file @
04a18c6b
...
...
@@ -16,6 +16,7 @@
import
org.junit.jupiter.api.AfterEach
;
// JUnit 5
import
org.junit.jupiter.api.BeforeEach
;
// JUnit 5
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.io.TempDir
;
import
picocli.CommandLine
;
...
...
@@ -28,18 +29,25 @@
private
static
final
Path
TEST_REPOSITORY
=
Paths
.
get
(
"src/test/resources/testdata/"
);
@TempDir
Path
tempDirectory
;
Path
outGML
;
@BeforeEach
public
void
setUp
Streams
()
{
public
void
setUp
()
{
out
.
reset
();
err
.
reset
();
System
.
setOut
(
new
PrintStream
(
out
));
System
.
setErr
(
new
PrintStream
(
err
));
outGML
=
tempDirectory
.
resolve
(
"output.gml"
);
}
@AfterEach
public
void
restore
Streams
()
{
public
void
restore
()
throws
IOException
{
System
.
setOut
(
originalOut
);
System
.
setErr
(
originalErr
);
Files
.
deleteIfExists
(
outGML
);
}
@Test
...
...
@@ -54,8 +62,7 @@ void testExtractRegionFromTwoCitygmls() throws IOException {
String
wktPolygon
=
"POLYGON((3512984.7003764412 5405148.310572891,3513038.6360455155 5405010.072163861,3513142.7277745553 5405004.02571992,3514204.1661769524 5405563.192081669,3514399.2818417274 5405720.905457244,3514291.6158155007 5405896.706492759,3512984.7003764412 5405148.310572891))"
;
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"
);
Path
inWKT
=
tempDirectory
.
resolve
(
"polygon.wkt"
);
try
(
BufferedWriter
wkt
=
Files
.
newBufferedWriter
(
inWKT
))
{
wkt
.
write
(
wktPolygon
);
}
...
...
@@ -73,8 +80,7 @@ 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"
);
Path
inWKT
=
tempDirectory
.
resolve
(
"polygon.wkt"
);
try
(
BufferedWriter
wkt
=
Files
.
newBufferedWriter
(
inWKT
))
{
wkt
.
write
(
wktPolygon
);
}
...
...
@@ -96,7 +102,6 @@ private long countBuildings(Path outGML) throws IOException {
void
testExtractRegionWithStandardInput
()
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"
);
Path
outGML
=
Files
.
createTempFile
(
"output"
,
".gml"
);
InputStream
stdin
=
new
ByteArrayInputStream
(
wktPolygon
.
getBytes
(
StandardCharsets
.
UTF_8
));
System
.
setIn
(
stdin
);
assertFalse
(
Files
.
exists
(
outGML
));
...
...
@@ -112,8 +117,7 @@ void testExtractRegionWithStandardInput() throws IOException {
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))"
;
Path
citygml
=
TEST_REPOSITORY
.
resolve
(
"NewYork.proj/ManhattanSmall.gml"
);
Path
outGML
=
Files
.
createTempFile
(
"output"
,
".gml"
);
Path
inWKT
=
Files
.
createTempFile
(
"polygon"
,
".wkt"
);
Path
inWKT
=
tempDirectory
.
resolve
(
"polygon.wkt"
);
try
(
BufferedWriter
wkt
=
Files
.
newBufferedWriter
(
inWKT
))
{
wkt
.
write
(
wktPolygon
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets