WebXmlIntegrator implements Integrator { Node createListenerNode(Document doc) { Node listenerNode = doc.createElement("listener"); Node listenerClassNode = doc.createElement("listener-class"); listenerClassNode.appendChild(doc.createTextNode(LISTENER_CLASS)); listenerNode.appendChild(listenerClassNode); return listenerNode; } WebXmlIntegrator();  WebXmlIntegrator(File webapp); void integrate(ArchiveType type); static final String FILTER_CLASS; static final String LISTENER_CLASS; }
@Test public void testCreateListenerNode() throws Exception { WebXmlIntegrator web = new WebXmlIntegrator(); Document doc = createEmptyDocument(); Node n = web.createListenerNode(doc); doc.appendChild(n); String expected ="<listener>"+ "<listener-class>"+WebXmlIntegrator.LISTENER_CLASS+"</listener-class>"+ "</listener>"; Document expDoc = XMLUnit.buildControlDocument(expected); assertXMLEqual(expDoc,doc); }