diff --git a/src/extension/mapml/src/test/java/org/geoserver/mapml/MapMLWMSFeatureTest.java b/src/extension/mapml/src/test/java/org/geoserver/mapml/MapMLWMSFeatureTest.java index 7cf79d422f4..d23dfe3978d 100644 --- a/src/extension/mapml/src/test/java/org/geoserver/mapml/MapMLWMSFeatureTest.java +++ b/src/extension/mapml/src/test/java/org/geoserver/mapml/MapMLWMSFeatureTest.java @@ -36,6 +36,7 @@ import org.geoserver.mapml.xml.MultiPolygon; import org.geoserver.mapml.xml.Point; import org.geoserver.mapml.xml.Polygon; +import org.geoserver.mapml.xml.Span; import org.geoserver.wms.GetMapRequest; import org.geoserver.wms.MapLayerInfo; import org.geoserver.wms.WMSMapContent; @@ -367,7 +368,7 @@ public void testMapMLFeaturePointHasClass() throws Exception { + " " + " " + " <#list gattribute.rawValue.coordinates as coord>" - + " <#if coord?index == 0>]]>${coord.x} ${coord.y}]]><#else>${coord.x} ${coord.y}" + + " <#if coord?index == 0>${coord.x} ${coord.y}<#else>${coord.x} ${coord.y}" + " " + " \n" + " \n" @@ -389,8 +390,8 @@ public void testMapMLFeaturePointHasClass() throws Exception { .getFeatures() .get(0); // get the second feature, which has a class Point featurePoint = (Point) feature2.getGeometry().getGeometryContent().getValue(); - String coords = featurePoint.getCoordinates().get(0).getCoordinates().get(0).toString(); - assertTrue(coords.contains("")); + Span span = ((Span) featurePoint.getCoordinates().get(0).getCoordinates().get(0)); + assertEquals("desired", span.getClazz()); } finally { if (template != null) { template.delete(); @@ -421,7 +422,7 @@ public void testMapMLFeatureLineHasClass() throws Exception { + "\n" + " <#list attributes as attribute>\n" + " <#if attribute.isGeometry>\n" - + " <#list attribute.rawValue.coordinates as coord><#if coord?index == 3> ]]>${coord.x} ${coord.y}<#elseif coord?index == 4>${coord.x} ${coord.y}]]><#else> ${coord.x} ${coord.y}\n" + + " <#list attribute.rawValue.coordinates as coord><#if coord?index == 3> ${coord.x} ${coord.y}<#elseif coord?index == 4>${coord.x} ${coord.y}<#else> ${coord.x} ${coord.y}\n" + " \n" + " \n" + "\n" @@ -443,8 +444,8 @@ public void testMapMLFeatureLineHasClass() throws Exception { .get(0); // get the second feature, which has a class LineString featureLine = (LineString) feature2.getGeometry().getGeometryContent().getValue(); - String coords = featureLine.getCoordinates().get(0).getCoordinates().get(0).toString(); - assertTrue(coords.contains("")); + Span span = (Span) featureLine.getCoordinates().get(0).getCoordinates().get(1); + assertEquals("desired", span.getClazz()); } finally { if (template != null) { template.delete(); @@ -477,9 +478,9 @@ public void testMapMLFeaturePolygonHasClass() throws Exception { + " <#if attribute.isGeometry>\n" + " \n" + " " - + " <#assign shell = attribute.rawValue.getExteriorRing()><#list shell.coordinates as coord><#if coord?index == 0>]]>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}]]><#else> ${coord.x} ${coord.y}" + + " <#assign shell = attribute.rawValue.getExteriorRing()><#list shell.coordinates as coord><#if coord?index == 0>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}<#else> ${coord.x} ${coord.y}" + " <#list 0 ..< attribute.rawValue.getNumInteriorRing() as index>" - + " <#assign hole = attribute.rawValue.getInteriorRingN(index)><#list hole.coordinates as coord><#if coord?index == 0>]]>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}]]><#else> ${coord.x} ${coord.y}" + + " <#assign hole = attribute.rawValue.getInteriorRingN(index)><#list hole.coordinates as coord><#if coord?index == 0>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}<#else> ${coord.x} ${coord.y}" + " " + " \n" + " \n" @@ -503,14 +504,14 @@ public void testMapMLFeaturePolygonHasClass() throws Exception { .get(0); // get the second feature, which has a class Polygon featurePolygon = (Polygon) feature2.getGeometry().getGeometryContent().getValue(); - String coords = - featurePolygon - .getThreeOrMoreCoordinatePairs() - .get(0) - .getCoordinates() - .get(0) - .toString(); - assertTrue(coords.contains("")); + Span span = + (Span) + featurePolygon + .getThreeOrMoreCoordinatePairs() + .get(0) + .getCoordinates() + .get(0); + assertEquals("desired", span.getClazz()); } finally { if (template != null) { template.delete(); @@ -547,9 +548,9 @@ public void testMapMLFeatureMultiPolygonHasClass() throws Exception { + " <#list 0 ..< attribute.rawValue.getNumGeometries() as index>" + " <#assign polygon = attribute.rawValue.getGeometryN(index)>" + " " - + " <#assign shell = polygon.getExteriorRing()><#list shell.coordinates as coord><#if coord?index == 0>]]>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}]]><#else> ${coord.x} ${coord.y}" + + " <#assign shell = polygon.getExteriorRing()><#list shell.coordinates as coord><#if coord?index == 0>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}<#else> ${coord.x} ${coord.y}" + " <#list 0 ..< polygon.getNumInteriorRing() as index>" - + " <#assign hole = polygon.getInteriorRingN(index)><#list hole.coordinates as coord><#if coord?index == 0>]]>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}]]><#else> ${coord.x} ${coord.y}" + + " <#assign hole = polygon.getInteriorRingN(index)><#list hole.coordinates as coord><#if coord?index == 0>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}<#else> ${coord.x} ${coord.y}" + " " + " " + " " @@ -593,16 +594,16 @@ public void testMapMLFeatureMultiPolygonHasClass() throws Exception { .get(0); // get the first feature, which has a class MultiPolygon featureMultiPolygon = (MultiPolygon) feature2.getGeometry().getGeometryContent().getValue(); - String coords = - featureMultiPolygon - .getPolygon() - .get(0) - .getThreeOrMoreCoordinatePairs() - .get(0) - .getCoordinates() - .get(0) - .toString(); - assertTrue(coords.contains("")); + Span span = + (Span) + featureMultiPolygon + .getPolygon() + .get(0) + .getThreeOrMoreCoordinatePairs() + .get(0) + .getCoordinates() + .get(0); + assertEquals("desired", span.getClazz()); } finally { if (template != null) { template.delete();