question: public void testMergeOneServletWithOneMappingIntoEmptyDocument ( ) throws Exception { String srcXml = "<web-app></web-app>" ; WebXml srcWebXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( srcXml . getBytes ( "UTF-8" ) ) , null ) ; String mergeXml = "<web-app>" + "  <servlet>" + "    <servlet-name>s1</servlet-name>" + "    <servlet-class>sclass1</servlet-class>" + "  </servlet>" + "  <servlet-mapping>" + "    <servlet-name>s1</servlet-name>" + "    <url-pattern>/s1mapping1</url-pattern>" + "  </servlet-mapping>" + "</web-app>" ; WebXml mergeWebXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( mergeXml . getBytes ( "UTF-8" ) ) , null ) ; WebXmlMerger merger = new WebXmlMerger ( srcWebXml ) ; merger . merge ( mergeWebXml ) ; assertTrue ( WebXmlUtils . hasServlet ( srcWebXml , "s1" ) ) ; List < String > servletMappings = WebXmlUtils . getServletMappings ( srcWebXml , "s1" ) ; assertEquals ( 1 , servletMappings . size ( ) ) ; assertEquals ( "/s1mapping1" , servletMappings . get ( 0 ) ) ; }
target:  Tests whether a single servlet with one mapping is correctly inserted into an empty descriptor.