XMLRoadUtil { public static Element writeRoadPolyline(RoadPolyline primitive, XMLBuilder builder, XMLResources resources) throws IOException { return writeMapElement(primitive, NODE_ROAD, builder, resources); } private  XMLRoadUtil(); static Element writeRoadPolyline(RoadPolyline primitive, XMLBuilder builder,
			XMLResources resources); static RoadPolyline readRoadPolyline(Element element, PathBuilder pathBuilder,
			XMLResources resources); static Element writeRoadSegment(RoadSegment primitive, XMLBuilder builder, XMLResources resources); static RoadSegment readRoadSegment(Element element, PathBuilder pathBuilder,
			XMLResources resources); static void writeRoadNetwork(Element xmlNode, RoadNetwork primitive, URL geometryURL,
			MapMetricProjection mapProjection, URL attributeURL, XMLBuilder builder,
			PathBuilder pathBuilder, XMLResources resources); static void readRoadNetwork(Element xmlNode, RoadNetwork primitive, PathBuilder pathBuilder,
			XMLResources resources); static StandardRoadNetwork readRoadNetwork(Element xmlNode, PathBuilder pathBuilder,
			XMLResources resources); static final String NODE_ROAD; static final String ATTR_HEIGHT; }
@Test public void writeRoadPolylineRoadPolylineXMLBuilderXMLResources() throws Exception { PathBuilder pathBuilder = new SimplePathBuilder(); XMLResources res = new XMLResources(pathBuilder); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.newDocument(); XMLBuilder xmlBuilder = new XMLBuilder() { @Override public Document getDocument() throws DOMException { return doc; } }; RoadPolyline road = new RoadPolyline(); road.addGroup(1, 2); road.addPoint(3, 4); road.addPoint(5, 6); road.addGroup(-1, 2); road.addPoint(-3, 4); road.addPoint(-5, -6); road.setName("myroad"); road.setColor(0xFFFF0011); road.setAttribute("myattr", "thevalue"); Element element = XMLRoadUtil.writeRoadPolyline(road, xmlBuilder, res); doc.appendChild(element); String actual; try (StringWriter sw = new StringWriter()) { XMLUtil.writeXML(doc, sw); sw.close(); actual = sw.toString(); } assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<road geoId=\"0ee8691041f80b41e4957e89239b4ff7#-5;-6;5;6\" id=\"" + road.getUUID().toString() + "\" name=\"myroad\" wide=\"true\" width=\"6.6\">" + "<points><point x=\"1.0\" y=\"2.0\"/><point x=\"3.0\" y=\"4.0\"/>" + "<point x=\"5.0\" y=\"6.0\"/><point x=\"-1.0\" y=\"2.0\"/>" + "<point x=\"-3.0\" y=\"4.0\"/><point x=\"-5.0\" y=\"-6.0\"/>" + "</points><groups><group firstPointIndex=\"0\" lastPointIndex=\"2\"/>" + "<group firstPointIndex=\"3\" lastPointIndex=\"5\"/></groups>" + "<attributes><attribute name=\"myattr\" type=\"STRING\" value=\"thevalue\"/>" + "<attribute name=\"nom_rue_d\" type=\"STRING\" value=\"myroad\"/></attributes></road>", actual); }