Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
21d23e3b
Commit
21d23e3b
authored
Apr 23, 2025
by
Riegel
Browse files
Test: Update Testcases for Visitor implementations
parent
f4a005d3
Changes
14
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
View file @
21d23e3b
...
@@ -87,6 +87,9 @@ public abstract class AbstractBuilding extends CityObject {
...
@@ -87,6 +87,9 @@ public abstract class AbstractBuilding extends CityObject {
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
ab
.
setLod0MultiCurve
(
null
);
ab
.
setLod2MultiCurve
(
null
);
ab
.
setLod3MultiCurve
(
null
);
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractRoom.java
View file @
21d23e3b
...
@@ -106,6 +106,9 @@ public abstract class AbstractRoom extends CityObject {
...
@@ -106,6 +106,9 @@ public abstract class AbstractRoom extends CityObject {
cgmlRoom
.
setLod1Solid
(
null
);
cgmlRoom
.
setLod1Solid
(
null
);
cgmlRoom
.
setLod2Solid
(
null
);
cgmlRoom
.
setLod2Solid
(
null
);
cgmlRoom
.
setLod3Solid
(
null
);
cgmlRoom
.
setLod3Solid
(
null
);
cgmlRoom
.
setLod0MultiCurve
(
null
);
cgmlRoom
.
setLod2MultiCurve
(
null
);
cgmlRoom
.
setLod3MultiCurve
(
null
);
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractTunnel.java
View file @
21d23e3b
...
@@ -61,14 +61,20 @@ public abstract class AbstractTunnel extends CityObject {
...
@@ -61,14 +61,20 @@ public abstract class AbstractTunnel extends CityObject {
@Override
@Override
public
void
unsetGmlGeometries
()
{
public
void
unsetGmlGeometries
()
{
at
.
setLod0MultiCurve
(
null
);
at
.
setLod2MultiCurve
(
null
);
at
.
setLod3MultiCurve
(
null
);
at
.
getDeprecatedProperties
().
setLod4MultiCurve
(
null
);
at
.
setLod1Solid
(
null
);
at
.
setLod1Solid
(
null
);
at
.
setLod2Solid
(
null
);
at
.
setLod2Solid
(
null
);
at
.
setLod3Solid
(
null
);
at
.
setLod3Solid
(
null
);
at
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
at
.
setLod0MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
at
.
setLod2MultiSurface
(
null
);
at
.
setLod2MultiSurface
(
null
);
at
.
setLod3MultiSurface
(
null
);
at
.
setLod3MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/GenericCityObject.java
View file @
21d23e3b
...
@@ -158,8 +158,13 @@ public class GenericCityObject extends CityObject {
...
@@ -158,8 +158,13 @@ public class GenericCityObject extends CityObject {
cgmlGos
.
setLod1Solid
(
null
);
cgmlGos
.
setLod1Solid
(
null
);
cgmlGos
.
setLod2Solid
(
null
);
cgmlGos
.
setLod2Solid
(
null
);
cgmlGos
.
setLod3Solid
(
null
);
cgmlGos
.
setLod3Solid
(
null
);
cgmlGos
.
setLod0MultiSurface
(
null
);
cgmlGos
.
setLod2MultiSurface
(
null
);
cgmlGos
.
setLod2MultiSurface
(
null
);
cgmlGos
.
setLod3MultiSurface
(
null
);
cgmlGos
.
setLod3MultiSurface
(
null
);
cgmlGos
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
cgmlGos
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
cgmlGos
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
cgmlGos
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vegetation.java
View file @
21d23e3b
...
@@ -189,18 +189,32 @@ public class Vegetation extends CityObject {
...
@@ -189,18 +189,32 @@ public class Vegetation extends CityObject {
@Override
@Override
public
void
unsetGmlGeometries
()
{
public
void
unsetGmlGeometries
()
{
citygmlVegetation
.
setLod0MultiSurface
(
null
);
citygmlVegetation
.
setLod2MultiSurface
(
null
);
citygmlVegetation
.
setLod3MultiSurface
(
null
);
citygmlVegetation
.
setLod1Solid
(
null
);
citygmlVegetation
.
setLod2Solid
(
null
);
citygmlVegetation
.
setLod3Solid
(
null
);
if
(
type
==
VegetationType
.
SOLITARY_VEGETATION_OBJECT
)
{
if
(
type
==
VegetationType
.
SOLITARY_VEGETATION_OBJECT
)
{
SolitaryVegetationObject
svo
=
(
SolitaryVegetationObject
)
citygmlVegetation
;
SolitaryVegetationObject
svo
=
(
SolitaryVegetationObject
)
citygmlVegetation
;
svo
.
setLod0MultiCurve
(
null
);
svo
.
setLod2MultiCurve
(
null
);
svo
.
setLod3MultiCurve
(
null
);
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
}
else
{
}
else
{
PlantCover
pc
=
(
PlantCover
)
citygmlVegetation
;
PlantCover
pc
=
(
PlantCover
)
citygmlVegetation
;
pc
.
setLod0MultiCurve
(
null
);
pc
.
setLod2MultiCurve
(
null
);
pc
.
setLod3MultiCurve
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
pc
.
setLod2MultiSurface
(
null
);
pc
.
setLod3MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod2MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod3MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSolid
(
null
);
}
}
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/WaterObject.java
View file @
21d23e3b
...
@@ -131,6 +131,16 @@ public class WaterObject extends CityObject {
...
@@ -131,6 +131,16 @@ public class WaterObject extends CityObject {
public
void
unsetGmlGeometries
()
{
public
void
unsetGmlGeometries
()
{
gmlWater
.
setLod0MultiSurface
(
null
);
gmlWater
.
setLod0MultiSurface
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
gmlWater
.
setLod2MultiSurface
(
null
);
gmlWater
.
setLod3MultiSurface
(
null
);
gmlWater
.
setLod1Solid
(
null
);
gmlWater
.
setLod2Solid
(
null
);
gmlWater
.
setLod3Solid
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
gmlWater
.
setLod0MultiCurve
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod1MultiCurve
(
null
);
gmlWater
.
setLod2MultiCurve
(
null
);
gmlWater
.
setLod3MultiCurve
(
null
);
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractRoomTest.java
View file @
21d23e3b
...
@@ -2,11 +2,13 @@ package de.hft.stuttgart.citydoctor2.datastructure;
...
@@ -2,11 +2,13 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.building.BuildingRoom
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundary
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundary
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.mockito.Mockito
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
...
@@ -14,6 +16,8 @@ import static org.junit.Assert.assertNull;
...
@@ -14,6 +16,8 @@ import static org.junit.Assert.assertNull;
public
class
AbstractRoomTest
{
public
class
AbstractRoomTest
{
//TODO: Add RecreateGeometries test
AbstractRoom
ab
;
AbstractRoom
ab
;
@Before
@Before
...
@@ -68,6 +72,10 @@ public class AbstractRoomTest {
...
@@ -68,6 +72,10 @@ public class AbstractRoomTest {
gmlAUS
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlAUS
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlAUS
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
ab
.
cgmlRoom
=
gmlAUS
;
ab
.
cgmlRoom
=
gmlAUS
;
ab
.
clearGmlGeometries
();
ab
.
clearGmlGeometries
();
...
@@ -78,6 +86,10 @@ public class AbstractRoomTest {
...
@@ -78,6 +86,10 @@ public class AbstractRoomTest {
assertNull
(
gmlAUS
.
getLod0MultiSurface
());
assertNull
(
gmlAUS
.
getLod0MultiSurface
());
assertNull
(
gmlAUS
.
getLod2MultiSurface
());
assertNull
(
gmlAUS
.
getLod2MultiSurface
());
assertNull
(
gmlAUS
.
getLod3MultiSurface
());
assertNull
(
gmlAUS
.
getLod3MultiSurface
());
assertNull
(
gmlAUS
.
getLod0MultiCurve
());
assertNull
(
gmlAUS
.
getLod2MultiCurve
());
assertNull
(
gmlAUS
.
getLod3MultiCurve
());
}
}
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/GeometryTestUtils.java
View file @
21d23e3b
...
@@ -21,9 +21,16 @@ package de.hft.stuttgart.citydoctor2.datastructure;
...
@@ -21,9 +21,16 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType
;
public
class
GeometryTestUtils
{
public
class
GeometryTestUtils
{
private
static
final
double
[]
expectedValues
=
new
double
[]{
427583.301
,
6003502.571
,
9.711
,
427583.304
,
6003502.574
,
9.713
,
427583.304
,
6003502.574
,
4.097
,
427583.301
,
6003502.571
,
4.097
,
427583.301
,
6003502.571
,
9.711
};
private
GeometryTestUtils
()
{
private
GeometryTestUtils
()
{
}
}
public
static
double
[]
getExpectedValues
()
{
return
expectedValues
;
}
public
static
Geometry
createDummyGeometry
(
GeometryType
type
)
{
public
static
Geometry
createDummyGeometry
(
GeometryType
type
)
{
return
createDummyGeometry
(
type
,
Lod
.
LOD2
);
return
createDummyGeometry
(
type
,
Lod
.
LOD2
);
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/LandObjectTest.java
0 → 100644
View file @
21d23e3b
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
org.citygml4j.core.model.landuse.LandUse
;
import
org.citygml4j.core.model.relief.ReliefFeature
;
import
org.citygml4j.core.model.relief.TINRelief
;
import
org.citygml4j.core.model.relief.TinProperty
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
LandObjectTest
{
@Test
public
void
testVisitorPropagationReliefObject
()
{
ReliefFeature
mockRelief
=
new
ReliefFeature
();
ReliefObject
relief
=
new
ReliefObject
(
mockRelief
);
TinObject
mockTin
=
mock
(
TinObject
.
class
);
relief
.
addComponent
(
mockTin
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
relief
.
accept
(
c
);
verify
(
mockTin
).
accept
(
c
);
}
@Test
public
void
testUnsetGeometriesTinObject
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
tir
.
setTin
(
new
TinProperty
());
tin
.
clearGmlGeometries
();
assertNull
(
tir
.
getTin
());
}
@Test
public
void
testUnsetGeometriesLandUse
()
{
LandUse
lu
=
new
LandUse
();
LandObject
land
=
new
LandObject
(
lu
);
lu
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
lu
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
land
.
clearGmlGeometries
();
assertNull
(
lu
.
getLod0MultiCurve
());
assertNull
(
lu
.
getLod0MultiSurface
());
assertNull
(
lu
.
getLod1MultiSurface
());
assertNull
(
lu
.
getLod2MultiSurface
());
assertNull
(
lu
.
getLod3MultiSurface
());
assertNull
(
lu
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
}
\ No newline at end of file
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObjectTest.java
View file @
21d23e3b
...
@@ -59,6 +59,9 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
...
@@ -59,6 +59,9 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
public
class
TransportationObjectTest
{
public
class
TransportationObjectTest
{
//TODO: Visitor Propagation testing
//TODO: Rework this class to be more in line with the other datastructure tests
@Test
@Test
public
void
testGetFeatureType
()
{
public
void
testGetFeatureType
()
{
TopLevelTransportFeature
to
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Road
.
class
));
TopLevelTransportFeature
to
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Road
.
class
));
...
@@ -293,40 +296,22 @@ public class TransportationObjectTest {
...
@@ -293,40 +296,22 @@ public class TransportationObjectTest {
Road
roadMock
=
mock
(
Road
.
class
);
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
verify
(
sectionMock
).
containsError
(
any
());
verify
(
intersectionMock
).
containsError
(
any
());
verify
(
tsMock
).
containsError
(
any
());
verify
(
auxTsMock
).
containsError
(
any
());
}
}
@Test
@Test
public
void
testContainsErrorTrafficSpace
()
{
public
void
testContainsErrorTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
verify
(
taMock
).
containsError
(
any
());
}
}
@Test
@Test
...
@@ -404,42 +389,23 @@ public class TransportationObjectTest {
...
@@ -404,42 +389,23 @@ public class TransportationObjectTest {
Road
roadMock
=
mock
(
Road
.
class
);
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
List
<
CheckError
>
errors
=
new
ArrayList
<>();
top
.
collectContainedErrors
(
errors
);
top
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
assertEquals
(
1
,
errors
.
size
());
verify
(
sectionMock
).
collectContainedErrors
(
errors
);
verify
(
intersectionMock
).
collectContainedErrors
(
errors
);
verify
(
tsMock
).
collectContainedErrors
(
errors
);
verify
(
auxTsMock
).
collectContainedErrors
(
errors
);
}
}
@Test
@Test
public
void
testCollectContainedErrorsTrafficSpace
()
{
public
void
testCollectContainedErrorsTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tso
.
collectContainedErrors
(
errors
);
tso
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
assertEquals
(
1
,
errors
.
size
());
verify
(
taMock
).
collectContainedErrors
(
errors
);
}
}
@Test
@Test
...
@@ -459,15 +425,6 @@ public class TransportationObjectTest {
...
@@ -459,15 +425,6 @@ public class TransportationObjectTest {
Road
r
=
mock
(
Road
.
class
);
Road
r
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
r
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
r
);
top
.
setGmlObject
(
r
);
top
.
setGmlObject
(
r
);
TransportSection
mockSection
=
mock
(
TransportSection
.
class
);
TransportSection
mockInterestSection
=
mock
(
TransportSection
.
class
);
TrafficSpaceObject
mockSpace
=
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxMockSpace
=
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
mockSection
);
top
.
addIntersection
(
mockInterestSection
);
top
.
addTrafficSpace
(
mockSpace
);
top
.
addAuxTrafficSpace
(
auxMockSpace
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
...
@@ -483,11 +440,6 @@ public class TransportationObjectTest {
...
@@ -483,11 +440,6 @@ public class TransportationObjectTest {
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
verify
(
mockSection
).
unsetGmlGeometries
();
verify
(
mockInterestSection
).
unsetGmlGeometries
();
verify
(
mockSpace
).
unsetGmlGeometries
();
verify
(
auxMockSpace
).
unsetGmlGeometries
();
}
}
@Test
@Test
...
@@ -495,9 +447,6 @@ public class TransportationObjectTest {
...
@@ -495,9 +447,6 @@ public class TransportationObjectTest {
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
t
=
mock
(
TrafficSpace
.
class
);
TrafficSpace
t
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
t
);
tso
.
setGmlObject
(
t
);
TrafficAreaObject
mockArea
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
mockArea
);
DeprecatedPropertiesOfAbstractCityObject
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractCityObject
.
class
);
DeprecatedPropertiesOfAbstractCityObject
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractCityObject
.
class
);
when
(
t
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
when
(
t
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
...
@@ -511,8 +460,6 @@ public class TransportationObjectTest {
...
@@ -511,8 +460,6 @@ public class TransportationObjectTest {
assertNull
(
t
.
getLod2MultiSurface
());
assertNull
(
t
.
getLod2MultiSurface
());
assertNull
(
t
.
getLod3MultiSurface
());
assertNull
(
t
.
getLod3MultiSurface
());
verify
(
mockArea
).
unsetGmlGeometries
();
}
}
@Test
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/VegetationTest.java
0 → 100644
View file @
21d23e3b
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
org.citygml4j.core.model.vegetation.PlantCover
;
import
org.citygml4j.core.model.vegetation.SolitaryVegetationObject
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.GeometryProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSolidProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
static
org
.
junit
.
Assert
.
assertNull
;
public
class
VegetationTest
{
//TODO: Recreate geometries tests
@Test
public
void
testUnsetGmlGeometriesPlantCover
()
{
Vegetation
plantCover
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
PlantCover
gmlCover
=
new
PlantCover
();
plantCover
.
setGmlObject
(
gmlCover
);
gmlCover
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlCover
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlCover
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
gmlCover
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod1Solid
(
new
SolidProperty
());
gmlCover
.
setLod2Solid
(
new
SolidProperty
());
gmlCover
.
setLod3Solid
(
new
SolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod1MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod2MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod3MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod4MultiSolid
(
new
MultiSolidProperty
());
plantCover
.
clearGmlGeometries
();
assertNull
(
gmlCover
.
getLod0MultiCurve
());
assertNull
(
gmlCover
.
getLod2MultiCurve
());
assertNull
(
gmlCover
.
getLod3MultiCurve
());
assertNull
(
gmlCover
.
getLod0MultiSurface
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlCover
.
getLod2MultiSurface
());
assertNull
(
gmlCover
.
getLod3MultiSurface
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNull
(
gmlCover
.
getLod1Solid
());
assertNull
(
gmlCover
.
getLod2Solid
());
assertNull
(
gmlCover
.
getLod3Solid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod1MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod2MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod3MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod4MultiSolid
());
}
@Test
public
void
testUnsetGmlGeometriesSolitaryVegetationObject
()
{
Vegetation
solitary
=
new
Vegetation
(
Vegetation
.
VegetationType
.
SOLITARY_VEGETATION_OBJECT
);
SolitaryVegetationObject
gmlSolitary
=
new
SolitaryVegetationObject
();
solitary
.
setGmlObject
(
gmlSolitary
);
gmlSolitary
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlSolitary
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlSolitary
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
gmlSolitary
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod1Solid
(
new
SolidProperty
());
gmlSolitary
.
setLod2Solid
(
new
SolidProperty
());
gmlSolitary
.
setLod3Solid
(
new
SolidProperty
());
gmlSolitary
.
getDeprecatedProperties
().
setLod1Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod2Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod3Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod4Geometry
(
new
GeometryProperty
<>());
solitary
.
clearGmlGeometries
();
assertNull
(
gmlSolitary
.
getLod0MultiCurve
());
assertNull
(
gmlSolitary
.
getLod2MultiCurve
());
assertNull
(
gmlSolitary
.
getLod3MultiCurve
());
assertNull
(
gmlSolitary
.
getLod0MultiSurface
());
assertNull
(
gmlSolitary
.
getLod2MultiSurface
());
assertNull
(
gmlSolitary
.
getLod3MultiSurface
());
assertNull
(
gmlSolitary
.
getLod1Solid
());
assertNull
(
gmlSolitary
.
getLod2Solid
());
assertNull
(
gmlSolitary
.
getLod3Solid
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod1Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod2Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod3Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod4Geometry
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/WaterTest.java
0 → 100644
View file @
21d23e3b
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
org.citygml4j.core.model.waterbody.WaterBody
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
WaterTest
{
@Test
public
void
testVisitorPropagation
()
{
WaterObject
water
=
new
WaterObject
();
BoundarySurface
bsMock
=
mock
(
BoundarySurface
.
class
);
BoundarySurface
bsMock2
=
mock
(
BoundarySurface
.
class
);
water
.
addBoundarySurface
(
bsMock
);
water
.
addBoundarySurface
(
bsMock2
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
water
.
accept
(
c
);
verify
(
bsMock
).
accept
(
c
);
verify
(
bsMock2
).
accept
(
c
);
}
@Test
public
void
testUnsetGmlGeometries
()
{
WaterObject
water
=
new
WaterObject
();
WaterBody
gmlWater
=
new
WaterBody
();
water
.
setGmlObject
(
gmlWater
);
gmlWater
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlWater
.
getDeprecatedProperties
().
setLod1MultiCurve
(
new
MultiCurveProperty
());
gmlWater
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlWater
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
gmlWater
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod1Solid
(
new
SolidProperty
());
gmlWater
.
setLod2Solid
(
new
SolidProperty
());
gmlWater
.
setLod3Solid
(
new
SolidProperty
());
gmlWater
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
());
water
.
clearGmlGeometries
();
assertNull
(
gmlWater
.
getLod0MultiCurve
());
assertNull
(
gmlWater
.
getDeprecatedProperties
().
getLod1MultiCurve
());
assertNull
(
gmlWater
.
getLod2MultiCurve
());
assertNull
(
gmlWater
.
getLod3MultiCurve
());
assertNull
(
gmlWater
.
getLod0MultiSurface
());
assertNull
(
gmlWater
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlWater
.
getLod2MultiSurface
());
assertNull
(
gmlWater
.
getLod3MultiSurface
());
assertNull
(
gmlWater
.
getLod1Solid
());
assertNull
(
gmlWater
.
getLod2Solid
());
assertNull
(
gmlWater
.
getLod3Solid
());
assertNull
(
gmlWater
.
getDeprecatedProperties
().
getLod4Solid
());
}
@Test
public
void
testRecreateGmlGeometries
()
{
WaterObject
water
=
new
WaterObject
();
// TODO: Implement test
}
}
CityDoctorParent/Extensions/CityDoctorHealer/src/test/java/de/hft/stuttgart/citydoctor2/healing/HealHoleOutsideErrorTest.java
View file @
21d23e3b
...
@@ -2,6 +2,8 @@ package de.hft.stuttgart.citydoctor2.healing;
...
@@ -2,6 +2,8 @@ package de.hft.stuttgart.citydoctor2.healing;
import
java.io.IOException
;
import
java.io.IOException
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -24,14 +26,14 @@ public class HealHoleOutsideErrorTest {
...
@@ -24,14 +26,14 @@ public class HealHoleOutsideErrorTest {
Checker
c
=
new
Checker
(
config
,
model
);
Checker
c
=
new
Checker
(
config
,
model
);
c
.
runChecks
();
c
.
runChecks
();
Geometry
geom
=
model
.
getBuildings
().
get
(
0
)
.
getGeometries
().
get
(
0
)
;
Building
building
=
model
.
getBuildings
().
get
(
0
);
Assert
.
assertTrue
(
geom
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
Assert
.
assertTrue
(
building
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
Healer
healer
=
new
Healer
(
c
);
Healer
healer
=
new
Healer
(
c
);
healer
.
healCityObject
(
model
.
getBuildings
().
get
(
0
));
healer
.
healCityObject
(
model
.
getBuildings
().
get
(
0
));
Assert
.
assertFalse
(
geom
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
Assert
.
assertFalse
(
building
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
}
}
}
CityDoctorParent/Extensions/CityDoctorHealerGenetic/src/test/java/de/hft/stuttgart/citydoctor2/healer/genetic/NonPlanarGenetic.java
View file @
21d23e3b
...
@@ -66,9 +66,9 @@ public class NonPlanarGenetic {
...
@@ -66,9 +66,9 @@ public class NonPlanarGenetic {
private
static
final
int
ERROR_PENALTY
=
100000
;
private
static
final
int
ERROR_PENALTY
=
100000
;
private
Random
r
=
new
Random
();
private
Random
r
=
new
Random
();
private
Map
<
Integer
,
List
<
Long
>>
durationMap
=
new
HashMap
<>();
private
Map
<
Integer
,
List
<
Long
>>
durationMap
=
new
HashMap
<>();
@Test
//
@Test
public
void
findVerticesForNonPlanarTest
()
throws
CityGmlParseException
,
InvalidGmlFileException
,
IOException
{
public
void
findVerticesForNonPlanarTest
()
throws
CityGmlParseException
,
InvalidGmlFileException
,
IOException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setNumberOfRoundingPlacesInGlobalParameters
(
8
);
config
.
setNumberOfRoundingPlacesInGlobalParameters
(
8
);
...
...
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