Commit d5af975e authored by Luna Riegel's avatar Luna Riegel
Browse files

Fix: Fix test failures

parent e178e81e
...@@ -106,7 +106,7 @@ public class PlanarTest { ...@@ -106,7 +106,7 @@ public class PlanarTest {
@Test @Test
public void testPlanarPolygon3() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testPlanarPolygon3() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-PO-0001-T0002.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-PO-0001-T0002.gml");
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
CheckResult cr = p.getCheckResult(CheckId.C_GE_P_NON_PLANAR); CheckResult cr = p.getCheckResult(CheckId.C_GE_P_NON_PLANAR);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
......
...@@ -43,7 +43,7 @@ public class PolygonIntersectingRingsTest { ...@@ -43,7 +43,7 @@ public class PolygonIntersectingRingsTest {
@Test @Test
public void testSelfIntPolygon1() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testSelfIntPolygon1() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml");
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
CheckResult cr = p.getCheckResult(CheckId.C_GE_P_INTERSECTING_RINGS); CheckResult cr = p.getCheckResult(CheckId.C_GE_P_INTERSECTING_RINGS);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
...@@ -52,7 +52,7 @@ public class PolygonIntersectingRingsTest { ...@@ -52,7 +52,7 @@ public class PolygonIntersectingRingsTest {
@Test @Test
public void testSelfIntPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testSelfIntPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-PO-0001-T0002.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-PO-0001-T0002.gml");
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
CheckResult cr = p.getCheckResult(CheckId.C_GE_P_INTERSECTING_RINGS); CheckResult cr = p.getCheckResult(CheckId.C_GE_P_INTERSECTING_RINGS);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
......
...@@ -91,7 +91,7 @@ public class RingClosedCheckTest extends TestCleanUp { ...@@ -91,7 +91,7 @@ public class RingClosedCheckTest extends TestCleanUp {
@Test @Test
public void testClosedRing3() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testClosedRing3() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml");
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
LinearRing r = p.getExteriorRing(); LinearRing r = p.getExteriorRing();
CheckResult cr = r.getCheckResult(CheckId.C_GE_R_NOT_CLOSED); CheckResult cr = r.getCheckResult(CheckId.C_GE_R_NOT_CLOSED);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
...@@ -111,7 +111,7 @@ public class RingClosedCheckTest extends TestCleanUp { ...@@ -111,7 +111,7 @@ public class RingClosedCheckTest extends TestCleanUp {
@Test @Test
public void testClosedRing5() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testClosedRing5() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0003-T0002.gml", 1); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0003-T0002.gml", 1);
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
LinearRing r = p.getExteriorRing(); LinearRing r = p.getExteriorRing();
CheckResult cr = r.getCheckResult(CheckId.C_GE_R_NOT_CLOSED); CheckResult cr = r.getCheckResult(CheckId.C_GE_R_NOT_CLOSED);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
......
...@@ -101,7 +101,7 @@ public class RingSelfIntersectionTest { ...@@ -101,7 +101,7 @@ public class RingSelfIntersectionTest {
@Test @Test
public void testSelfIntPoints4() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testSelfIntPoints4() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml");
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
LinearRing r = p.getExteriorRing(); LinearRing r = p.getExteriorRing();
CheckResult cr = r.getCheckResult(CheckId.C_GE_R_SELF_INTERSECTION); CheckResult cr = r.getCheckResult(CheckId.C_GE_R_SELF_INTERSECTION);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
...@@ -131,7 +131,7 @@ public class RingSelfIntersectionTest { ...@@ -131,7 +131,7 @@ public class RingSelfIntersectionTest {
@Test @Test
public void testSelfIntPoints7() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testSelfIntPoints7() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0004-T0005.gml", 2); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0004-T0005.gml", 2);
for (Polygon p : c.getBuildings().get(0).getGeometries().get(0).getPolygons()) { for (Polygon p : c.getBuildings().toList().get(0).getGeometries().get(0).getPolygons()) {
LinearRing r = p.getExteriorRing(); LinearRing r = p.getExteriorRing();
CheckResult cr = r.getCheckResult(CheckId.C_GE_R_SELF_INTERSECTION); CheckResult cr = r.getCheckResult(CheckId.C_GE_R_SELF_INTERSECTION);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
......
...@@ -43,7 +43,7 @@ public class ShellNotClosedSystemTest { ...@@ -43,7 +43,7 @@ public class ShellNotClosedSystemTest {
@Test @Test
public void testShellNotClosed1() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testShellNotClosed1() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml");
Geometry g = c.getBuildings().get(0).getGeometries().get(0); Geometry g = c.getBuildings().toList().get(0).getGeometries().get(0);
CheckResult cr = g.getCheckResult(CheckId.C_GE_S_NOT_CLOSED); CheckResult cr = g.getCheckResult(CheckId.C_GE_S_NOT_CLOSED);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
...@@ -51,7 +51,7 @@ public class ShellNotClosedSystemTest { ...@@ -51,7 +51,7 @@ public class ShellNotClosedSystemTest {
@Test @Test
public void testShellNotClosed2() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testShellNotClosed2() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml");
Geometry g = c.getBuildings().get(0).getGeometries().get(0); Geometry g = c.getBuildings().toList().get(0).getGeometries().get(0);
CheckResult cr = g.getCheckResult(CheckId.C_GE_S_NOT_CLOSED); CheckResult cr = g.getCheckResult(CheckId.C_GE_S_NOT_CLOSED);
assertEquals(ResultStatus.ERROR, cr.getResultStatus()); assertEquals(ResultStatus.ERROR, cr.getResultStatus());
assertEquals(ErrorId.GE_S_NOT_CLOSED, cr.getError().getErrorId()); assertEquals(ErrorId.GE_S_NOT_CLOSED, cr.getError().getErrorId());
......
...@@ -22,6 +22,7 @@ import java.io.IOException; ...@@ -22,6 +22,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.Checker; import de.hft.stuttgart.citydoctor2.check.Checker;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
...@@ -89,15 +90,16 @@ public class TestUtil { ...@@ -89,15 +90,16 @@ public class TestUtil {
if (gmlId == null) { if (gmlId == null) {
return null; return null;
} }
Polygon result = getPolygonById(gmlId, model.getBuildings()); Polygon result = getPolygonById(gmlId, model.getBuildings().toList());
if (result != null) { if (result != null) {
return result; return result;
} }
result = getPolygonById(gmlId, model.getVegetation()); result = getPolygonById(gmlId, model.getVegetation().toList());
if (result != null) { if (result != null) {
return result; return result;
} }
return getPolygonById(gmlId, model.getTransportation()); return getPolygonById(gmlId, model.getTransportation().toList());
} }
private static Polygon getPolygonById(String gmlId, List<? extends CityObject> features) { private static Polygon getPolygonById(String gmlId, List<? extends CityObject> features) {
...@@ -136,22 +138,17 @@ public class TestUtil { ...@@ -136,22 +138,17 @@ public class TestUtil {
if (featureId == null) { if (featureId == null) {
return null; return null;
} }
for (CityObject co : model.getBuildings()) { Optional<? extends CityObject> result = null;
if (featureId.equals(co.getGmlId().getGmlString())) { result = model.getBuildings().filter(b -> featureId.equals(b.getGmlId().toString())).findFirst();
return co; if (result.isPresent()){
} return result.get();
} }
for (CityObject co : model.getTransportation()) { result = model.getTransportation().filter(t-> featureId.equals(t.getGmlId().toString())).findFirst();
if (featureId.equals(co.getGmlId().getGmlString())) { if (result.isPresent()){
return co; return result.get();
}
} }
for (CityObject co : model.getVegetation()) { result = model.getVegetation().filter(t-> featureId.equals(t.getGmlId().toString())).findFirst();
if (featureId.equals(co.getGmlId().getGmlString())) { return result.orElse(null);
return co; }
}
}
return null;
}
} }
...@@ -43,7 +43,7 @@ public class TooFewPolygonsSystemTest { ...@@ -43,7 +43,7 @@ public class TooFewPolygonsSystemTest {
@Test @Test
public void testTooFewPolygons1() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testTooFewPolygons1() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS.gml");
Geometry g = c.getBuildings().get(0).getGeometries().get(0); Geometry g = c.getBuildings().toList().get(0).getGeometries().get(0);
CheckResult cr = g.getCheckResult(CheckId.C_GE_S_TOO_FEW_POLYGONS); CheckResult cr = g.getCheckResult(CheckId.C_GE_S_TOO_FEW_POLYGONS);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
...@@ -51,7 +51,7 @@ public class TooFewPolygonsSystemTest { ...@@ -51,7 +51,7 @@ public class TooFewPolygonsSystemTest {
@Test @Test
public void testTooFewPolygons2() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testTooFewPolygons2() throws CityGmlParseException, IOException, InvalidGmlFileException {
CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0001-T0001.gml"); CityDoctorModel c = TestUtil.loadAndCheckCityModel("src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0001-T0001.gml");
Geometry g = c.getBuildings().get(0).getGeometries().get(0); Geometry g = c.getBuildings().toList().get(0).getGeometries().get(0);
CheckResult cr = g.getCheckResult(CheckId.C_GE_S_TOO_FEW_POLYGONS); CheckResult cr = g.getCheckResult(CheckId.C_GE_S_TOO_FEW_POLYGONS);
assertEquals(ResultStatus.ERROR, cr.getResultStatus()); assertEquals(ResultStatus.ERROR, cr.getResultStatus());
assertEquals(ErrorId.GE_S_TOO_FEW_POLYGONS, cr.getError().getErrorId()); assertEquals(ErrorId.GE_S_TOO_FEW_POLYGONS, cr.getError().getErrorId());
......
...@@ -24,11 +24,11 @@ public class HealAllPolygonsWrongOrientationErrorTest { ...@@ -24,11 +24,11 @@ public class HealAllPolygonsWrongOrientationErrorTest {
CityDoctorModel model = TestUtil.loadCityModel(path, config); CityDoctorModel model = TestUtil.loadCityModel(path, config);
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION));
} }
......
...@@ -26,11 +26,11 @@ public class HealConsecutivePointsSameErrorTest { ...@@ -26,11 +26,11 @@ public class HealConsecutivePointsSameErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_DUPLICATE_POINT)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_DUPLICATE_POINT));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_DUPLICATE_POINT)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_DUPLICATE_POINT));
} }
......
...@@ -25,11 +25,11 @@ public class HealHoleOutsideErrorTest { ...@@ -25,11 +25,11 @@ public class HealHoleOutsideErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building building = model.getBuildings().get(0); Building building = model.getBuildings().toList().get(0);
Assert.assertTrue(building.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().toList().get(0));
Assert.assertFalse(building.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); Assert.assertFalse(building.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
} }
......
...@@ -138,7 +138,7 @@ public class HealMissingSolidTest { ...@@ -138,7 +138,7 @@ public class HealMissingSolidTest {
model.saveAs(createSolidFile.toString(), false); model.saveAs(createSolidFile.toString(), false);
CityDoctorModel parsedModel = CityGmlParser.parseCityGmlFile(createSolidFile.toString(), config.getParserConfiguration()); CityDoctorModel parsedModel = CityGmlParser.parseCityGmlFile(createSolidFile.toString(), config.getParserConfiguration());
Building building = parsedModel.getBuildings().get(0); Building building = parsedModel.getBuildings().toList().get(0);
assertEquals(1, building.getGeometries().size()); assertEquals(1, building.getGeometries().size());
Geometry geometry2 = building.getGeometries().get(0); Geometry geometry2 = building.getGeometries().get(0);
assertEquals(GeometryType.SOLID, geometry2.getType()); assertEquals(GeometryType.SOLID, geometry2.getType());
...@@ -162,7 +162,7 @@ public class HealMissingSolidTest { ...@@ -162,7 +162,7 @@ public class HealMissingSolidTest {
new RequirementConfiguration(false)); new RequirementConfiguration(false));
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/SimpleSolid_SrefBS_withoutSolid.gml", CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/SimpleSolid_SrefBS_withoutSolid.gml",
config.getParserConfiguration()); config.getParserConfiguration());
Building b = model.getBuildings().get(0); Building b = model.getBuildings().toList().get(0);
assertTrue(b.getGeometries().isEmpty()); assertTrue(b.getGeometries().isEmpty());
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
......
...@@ -25,11 +25,11 @@ public class HealNonManifoldEdgeErrorTest { ...@@ -25,11 +25,11 @@ public class HealNonManifoldEdgeErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE));
} }
......
...@@ -43,12 +43,12 @@ public class HealPlanarPolygonErrorTest { ...@@ -43,12 +43,12 @@ public class HealPlanarPolygonErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(2); healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
......
...@@ -35,11 +35,11 @@ public class HealPolygonWithoutSurfaceTest { ...@@ -35,11 +35,11 @@ public class HealPolygonWithoutSurfaceTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building building = model.getBuildings().get(0); Building building = model.getBuildings().toList().get(0);
Assert.assertTrue(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertTrue(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
...@@ -49,7 +49,7 @@ public class HealPolygonWithoutSurfaceTest { ...@@ -49,7 +49,7 @@ public class HealPolygonWithoutSurfaceTest {
CityDoctorModel loadedModel = TestUtil.loadCityModel(outputFile.toString(), config); CityDoctorModel loadedModel = TestUtil.loadCityModel(outputFile.toString(), config);
c = new Checker(config, loadedModel); c = new Checker(config, loadedModel);
c.runChecks(); c.runChecks();
building = loadedModel.getBuildings().get(0); building = loadedModel.getBuildings().toList().get(0);
Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
} }
......
...@@ -41,11 +41,11 @@ public class HealPolygonWrongOrientationErrorTest { ...@@ -41,11 +41,11 @@ public class HealPolygonWrongOrientationErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION));
} }
......
...@@ -25,11 +25,11 @@ public class HealRingNotClosedErrorTest { ...@@ -25,11 +25,11 @@ public class HealRingNotClosedErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_NOT_CLOSED)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_NOT_CLOSED));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_NOT_CLOSED)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_NOT_CLOSED));
} }
......
...@@ -190,11 +190,11 @@ public class HealRingSelfIntErrorTest { ...@@ -190,11 +190,11 @@ public class HealRingSelfIntErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
...@@ -208,11 +208,11 @@ public class HealRingSelfIntErrorTest { ...@@ -208,11 +208,11 @@ public class HealRingSelfIntErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
...@@ -228,11 +228,11 @@ public class HealRingSelfIntErrorTest { ...@@ -228,11 +228,11 @@ public class HealRingSelfIntErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
......
...@@ -26,11 +26,11 @@ public class HealSameOrientationErrorTest { ...@@ -26,11 +26,11 @@ public class HealSameOrientationErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME)); Assert.assertTrue(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME)); Assert.assertFalse(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME));
} }
......
...@@ -439,7 +439,7 @@ public class HealSolidNotClosedErrorTest { ...@@ -439,7 +439,7 @@ public class HealSolidNotClosedErrorTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
geom.updateVertices(); geom.updateVertices();
for (Vertex v : geom.getVertices()) { for (Vertex v : geom.getVertices()) {
v.setX(v.getX() - 10); v.setX(v.getX() - 10);
...@@ -449,7 +449,7 @@ public class HealSolidNotClosedErrorTest { ...@@ -449,7 +449,7 @@ public class HealSolidNotClosedErrorTest {
Healer healer = new Healer(c); Healer healer = new Healer(c);
//healer.setNumberOfIterations(2); //healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
} }
......
...@@ -27,11 +27,11 @@ public class HealTooFewPointsTest { ...@@ -27,11 +27,11 @@ public class HealTooFewPointsTest {
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); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
assertTrue(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS)); assertTrue(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
assertFalse(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS)); assertFalse(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS));
} }
......
Supports Markdown
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