### Question:
WFSNodeWriter { public static void writeToNode(Node node, List<WFSLayerState> layerStates) { Document doc = node instanceof Document ? (Document)node : node.getOwnerDocument(); try { Element dataLayerNode = (Element)StateXML.createChildNode(node, doc, node, StateConstants.DATA_LAYERS_PATH, StateConstants.LAYERS_NAME); dataLayerNode.setAttribute("type", StateConstants.DATA_LAYERS_TYPE); addToNode(dataLayerNode, layerStates); } catch (XPathExpressionException e) { LOGGER.error(e.getMessage(), e); } } private  WFSNodeWriter(); static void writeToNode(Node node, List<WFSLayerState> layerStates);  }### Answer:
@Test public void test() throws JAXBException, ParserConfigurationException, XPathExpressionException { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Node node = doc.appendChild(StateXML.createElement(doc, ModuleStateController.STATE_NAME)); List<WFSLayerState> layerStates = New.list(); for (LayerConfiguration configuration : myLayerConfigurationManager.getAllConfigurations()) { createLayerStates(layerStates, configuration.getName()); } WFSNodeWriter.writeToNode(node, layerStates); NodeList nodes = node.getFirstChild().getChildNodes(); assertTrue(nodes.getLength() == 3); assertEquals("wfs", nodes.item(0).getAttributes().getNamedItem("type").getTextContent()); assertEquals("geoserverWFS", nodes.item(1).getAttributes().getNamedItem("type").getTextContent()); assertEquals("arcWFS", nodes.item(2).getAttributes().getNamedItem("type").getTextContent()); }