@Test public void whenEncodeLineStringWithoutElementThenEncodeWithDefaultElement() throws Exception { GMLComplexType instance = GMLComplexTypes.LineStringPropertyType.getInstance(); LineString value = mock(LineString.class); when(value.getNumPoints()).thenReturn(2); PrintHandler printHandler = mock(PrintHandler.class); try { instance.encode(null, value, printHandler, null); verify(printHandler).startElement(GMLSchema.NAMESPACE, "lineStringProperty", null); verify(printHandler).endElement(GMLSchema.NAMESPACE, "lineStringProperty"); } catch (OperationNotSupportedException e) { Assert.fail(); } }
static void encode(Element e, Geometry g, PrintHandler output) throws OperationNotSupportedException, IOException { if (g instanceof Point) { encode(e, (Point) g, output); return; } if (g instanceof Polygon) { encode(e, (Polygon) g, output); return; } if (g instanceof LinearRing) { encode(e, (LinearRing) g, output); return; } if (g instanceof LineString) { encode(e, (LineString) g, output); return; } if (g instanceof MultiLineString) { encode(e, (MultiLineString) g, output); return; } if (g instanceof MultiPolygon) { encode(e, (MultiPolygon) g, output); return; } if (g instanceof MultiPoint) { encode(e, (MultiPoint) g, output); return; } if (g instanceof GeometryCollection) { encode(e, (GeometryCollection) g, output); return; } }
GMLComplexTypes { static void encode(Element e, Geometry g, PrintHandler output) throws OperationNotSupportedException, IOException { if (g instanceof Point) { encode(e, (Point) g, output); return; } if (g instanceof Polygon) { encode(e, (Polygon) g, output); return; } if (g instanceof LinearRing) { encode(e, (LinearRing) g, output); return; } if (g instanceof LineString) { encode(e, (LineString) g, output); return; } if (g instanceof MultiLineString) { encode(e, (MultiLineString) g, output); return; } if (g instanceof MultiPolygon) { encode(e, (MultiPolygon) g, output); return; } if (g instanceof MultiPoint) { encode(e, (MultiPoint) g, output); return; } if (g instanceof GeometryCollection) { encode(e, (GeometryCollection) g, output); return; } } }
GMLComplexTypes { static void encode(Element e, Geometry g, PrintHandler output) throws OperationNotSupportedException, IOException { if (g instanceof Point) { encode(e, (Point) g, output); return; } if (g instanceof Polygon) { encode(e, (Polygon) g, output); return; } if (g instanceof LinearRing) { encode(e, (LinearRing) g, output); return; } if (g instanceof LineString) { encode(e, (LineString) g, output); return; } if (g instanceof MultiLineString) { encode(e, (MultiLineString) g, output); return; } if (g instanceof MultiPolygon) { encode(e, (MultiPolygon) g, output); return; } if (g instanceof MultiPoint) { encode(e, (MultiPoint) g, output); return; } if (g instanceof GeometryCollection) { encode(e, (GeometryCollection) g, output); return; } }  }
GMLComplexTypes { static void encode(Element e, Geometry g, PrintHandler output) throws OperationNotSupportedException, IOException { if (g instanceof Point) { encode(e, (Point) g, output); return; } if (g instanceof Polygon) { encode(e, (Polygon) g, output); return; } if (g instanceof LinearRing) { encode(e, (LinearRing) g, output); return; } if (g instanceof LineString) { encode(e, (LineString) g, output); return; } if (g instanceof MultiLineString) { encode(e, (MultiLineString) g, output); return; } if (g instanceof MultiPolygon) { encode(e, (MultiPolygon) g, output); return; } if (g instanceof MultiPoint) { encode(e, (MultiPoint) g, output); return; } if (g instanceof GeometryCollection) { encode(e, (GeometryCollection) g, output); return; } }  static SimpleFeatureType createFeatureType(Element element); static SimpleFeatureType createFeatureType(ComplexType element); }
GMLComplexTypes { static void encode(Element e, Geometry g, PrintHandler output) throws OperationNotSupportedException, IOException { if (g instanceof Point) { encode(e, (Point) g, output); return; } if (g instanceof Polygon) { encode(e, (Polygon) g, output); return; } if (g instanceof LinearRing) { encode(e, (LinearRing) g, output); return; } if (g instanceof LineString) { encode(e, (LineString) g, output); return; } if (g instanceof MultiLineString) { encode(e, (MultiLineString) g, output); return; } if (g instanceof MultiPolygon) { encode(e, (MultiPolygon) g, output); return; } if (g instanceof MultiPoint) { encode(e, (MultiPoint) g, output); return; } if (g instanceof GeometryCollection) { encode(e, (GeometryCollection) g, output); return; } }  static SimpleFeatureType createFeatureType(Element element); static SimpleFeatureType createFeatureType(ComplexType element);  }