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
CityDoctor
CityDoctor2
Commits
066ab1cc
Commit
066ab1cc
authored
3 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Test: Streamline testcases
parent
d111173b
master
dev
dev_cpp_code_conversion
dev_gui_features_zip_loading
3.17.0
archive/dev_gui_features_zip_loading
2 merge requests
!28
Version 3.17.0 Release
,
!26
Add ZIP-archive support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java
+8
-17
.../java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java
with
8 additions
and
17 deletions
+8
-17
CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java
+
8
-
17
View file @
066ab1cc
...
...
@@ -9,6 +9,8 @@ import org.junit.rules.ExpectedException;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.*;
...
...
@@ -22,6 +24,10 @@ public class ZipTest {
@Test
public
void
testUnzipping
()
{
CityGmlArchive
cgmlArch
=
CityGmlArchive
.
fromZipFile
(
"src/test/resources/mock_archive.zip"
,
config
);
checkMockArchive
(
cgmlArch
);
}
private
void
checkMockArchive
(
CityGmlArchive
cgmlArch
){
assertNotNull
(
cgmlArch
);
assertEquals
(
5
,
cgmlArch
.
getEntries
().
size
());
for
(
CityGmlZipEntry
entry
:
cgmlArch
.
getEntries
())
{
...
...
@@ -29,18 +35,10 @@ public class ZipTest {
assertTrue
(
entry
.
getFileName
().
matches
(
"^mock[1-5].gml$"
));
assertFalse
(
entry
instanceof
ErroneousEntry
);
assertNotNull
(
entry
.
getModel
());
assertEquals
(
1
,
entry
.
getModel
().
getNumberOfFeatures
());
}
}
@Test
public
void
testZippingWithFaultyFilepath
(){
CityGmlArchive
cgmlArch
=
CityGmlArchive
.
fromZipFile
(
"src/test/resources/mock_archive.zip"
,
config
);
excRule
.
expect
(
IllegalArgumentException
.
class
);
excRule
.
expectMessage
(
"Target zip-filepath must end with '.zip'"
);
cgmlArch
.
exportToZipFile
(
"src/test/resources/mock"
);
}
@Test
public
void
testZipping
()
throws
IOException
{
CityGmlArchive
cgmlArch
=
CityGmlArchive
.
fromZipFile
(
"src/test/resources/mock_archive.zip"
,
config
);
...
...
@@ -51,14 +49,7 @@ public class ZipTest {
String
expPath
=
tmpDir
.
toString
()
+
"/export.zip"
;
cgmlArch
.
exportToZipFile
(
expPath
);
CityGmlArchive
cgmlExport
=
CityGmlArchive
.
fromZipFile
(
expPath
,
config
);
assertNotNull
(
cgmlExport
);
assertEquals
(
5
,
cgmlExport
.
getEntries
().
size
());
for
(
CityGmlZipEntry
entry
:
cgmlExport
.
getEntries
())
{
assertNotNull
(
entry
);
assertTrue
(
entry
.
getFileName
().
matches
(
"^mock[1-5].gml$"
));
assertFalse
(
entry
instanceof
ErroneousEntry
);
assertNotNull
(
entry
.
getModel
());
}
checkMockArchive
(
cgmlExport
);
}
catch
(
Exception
e
)
{
// Rethrow Exceptions to ensure deletion of tmpDir with finally block
throw
e
;
...
...
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