public void testMergeOneFilterIntoDocumentWithAnotherFilter() throws Exception {
  String srcXml="<web-app>" + "  <filter>" + "    <filter-name>f1</filter-name>"+ "    <filter-class>fclass1</filter-class>"+ "  </filter>"+ "</web-app>";
  WebXml srcWebXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(srcXml.getBytes("UTF-8")),null);
  String mergeXml="<web-app>" + "  <filter>" + "    <filter-name>f2</filter-name>"+ "    <filter-class>fclass2</filter-class>"+ "  </filter>"+ "</web-app>";
  WebXml mergeWebXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(mergeXml.getBytes("UTF-8")),null);
  WebXmlMerger merger=new WebXmlMerger(srcWebXml);
  merger.mergeFilters(mergeWebXml);
  assertTrue(WebXmlUtils.hasFilter(srcWebXml,"f1"));
  assertTrue(WebXmlUtils.hasFilter(srcWebXml,"f2"));
}

public void testMergeOneFilterIntoDocumentWithAnotherFilter ( ) throws Exception { String srcXml = "<web-app>" + "  <filter>" + "    <filter-name>f1</filter-name>" + "    <filter-class>fclass1</filter-class>" + "  </filter>" + "</web-app>" ; WebXml srcWebXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( srcXml . getBytes ( "UTF-8" ) ) , null ) ; String mergeXml = "<web-app>" + "  <filter>" + "    <filter-name>f2</filter-name>" + "    <filter-class>fclass2</filter-class>" + "  </filter>" + "</web-app>" ; WebXml mergeWebXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( mergeXml . getBytes ( "UTF-8" ) ) , null ) ; WebXmlMerger merger = new WebXmlMerger ( srcWebXml ) ; merger . mergeFilters ( mergeWebXml ) ; assertTrue ( WebXmlUtils . hasFilter ( srcWebXml , "f1" ) ) ; assertTrue ( WebXmlUtils . hasFilter ( srcWebXml , "f2" ) ) ; }
tests whether a single filter is correctly merged into a descriptor that already contains another filter .
