WebXmlIntegrator implements Integrator { Node createFilterNode(Document doc) { Node filterNode = doc.createElement("filter"); Node filterNameNode = doc.createElement("filter-name"); filterNameNode.appendChild(doc.createTextNode("infrared")); Node filterClassNode = doc.createElement("filter-class"); filterClassNode.appendChild(doc.createTextNode(FILTER_CLASS)); filterNode.appendChild(filterNameNode); filterNode.appendChild(filterClassNode); return filterNode; } WebXmlIntegrator();  WebXmlIntegrator(File webapp); void integrate(ArchiveType type); static final String FILTER_CLASS; static final String LISTENER_CLASS; }
@Test public void testCreateFilterNode() throws Exception{ WebXmlIntegrator web = new WebXmlIntegrator(); Document doc = createEmptyDocument(); Node n = web.createFilterNode(doc); doc.appendChild(n); String expected = " <filter><filter-name>infrared</filter-name>"+ "<filter-class>"+WebXmlIntegrator.FILTER_CLASS+"</filter-class>"+ "</filter>"; Document expDoc = XMLUnit.buildControlDocument(expected); assertXMLEqual(expDoc,doc); }