package de.hft.stuttgart.citydoctor2.checks.semantics;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.check.error.PolygonWithoutSurfaceError;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
public class PolygonWithoutSurfaceCheckTest {
@Test
public void testPolygonWithoutSurface() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
Polygon poly = new ConcretePolygon();
geom.addPolygon(poly);
PolygonWithoutSurfaceCheck check = new PolygonWithoutSurfaceCheck();
poly.accept(check);
CheckResult checkResult = poly.getCheckResult(check);
assertNotNull(checkResult);
assertEquals(ResultStatus.ERROR, checkResult.getResultStatus());
assertEquals(CheckId.C_SE_POLYGON_WITHOUT_SURFACE, checkResult.getCheckIdentifier());
CheckError error = checkResult.getError();
assertNotNull(error);
assertEquals(ErrorId.SE_POLYGON_WITHOUT_SURFACE, error.getErrorId());
assertTrue(error instanceof PolygonWithoutSurfaceError);
PolygonWithoutSurfaceError errorCast = (PolygonWithoutSurfaceError) error;
assertSame(poly, errorCast.getPolygon());
}
@Test
public void testPolygonWithSurface() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
Polygon poly = new ConcretePolygon();
BoundarySurface bs = new BoundarySurface(null);
bs.addGeometry(geom);
geom.addPolygon(poly);
PolygonWithoutSurfaceCheck check = new PolygonWithoutSurfaceCheck();
poly.accept(check);
CheckResult checkResult = poly.getCheckResult(check);
assertNotNull(checkResult);
assertEquals(ResultStatus.OK, checkResult.getResultStatus());
assertEquals(CheckId.C_SE_POLYGON_WITHOUT_SURFACE, checkResult.getCheckIdentifier());
CheckError error = checkResult.getError();
assertNull(error);
}
@Test
public void testPolygonWithWrongLod() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1);
Polygon poly = new ConcretePolygon();
BoundarySurface bs = new BoundarySurface(null);
bs.addGeometry(geom);
geom.addPolygon(poly);
PolygonWithoutSurfaceCheck check = new PolygonWithoutSurfaceCheck();
poly.accept(check);
CheckResult checkResult = poly.getCheckResult(check);
assertNull(checkResult);
}
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.13.1</version> <version>3.14.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>CityDoctorParent</name> <name>CityDoctorParent</name>
<properties> <properties>
...@@ -103,12 +103,12 @@ ...@@ -103,12 +103,12 @@
<dependency> <dependency>
<groupId>org.citygml4j</groupId> <groupId>org.citygml4j</groupId>
<artifactId>citygml4j-core</artifactId> <artifactId>citygml4j-core</artifactId>
<version>3.0.0</version> <version>3.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.citygml4j</groupId> <groupId>org.citygml4j</groupId>
<artifactId>citygml4j-xml</artifactId> <artifactId>citygml4j-xml</artifactId>
<version>3.0.0</version> <version>3.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
...@@ -156,6 +156,11 @@ ...@@ -156,6 +156,11 @@
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>${log4j.version}</version> <version>${log4j.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
......