### Question:
WebXmlUtils { public static void addErrorCode(final Integer errorCode, final String location, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notNull(errorCode, "Error code required"); Validate.notBlank(location, "Location required"); Element errorPageElement = XmlUtils.findFirstElement( WEB_APP_XPATH + "error-page[error-code = '" + errorCode.toString() + "']", document.getDocumentElement()); if (errorPageElement == null) { errorPageElement = new XmlElementBuilder("error-page", document).addChild( new XmlElementBuilder("error-code", document).setText(errorCode.toString()).build()) .build(); insertBetween(errorPageElement, "welcome-file-list[last()]", "the-end", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(errorPageElement, comment, document); } } appendChildIfNotPresent(errorPageElement, new XmlElementBuilder("location", document).setText(location).build()); } private  WebXmlUtils(); static void addContextParam(final WebXmlParam contextParam, final Document document,
      final String comment); static void addErrorCode(final Integer errorCode, final String location,
      final Document document, final String comment); static void addExceptionType(final String exceptionType, final String location,
      final Document document, final String comment); static void addFilter(final String filterName, final String filterClass,
      final String urlPattern, final Document document, final String comment,
      final WebXmlParam... initParams); static void addFilterAtPosition(final FilterPosition filterPosition,
      final String afterFilterName, final String beforeFilterName, final String filterName,
      final String filterClass, final String urlPattern, final Document document,
      final String comment, List<WebXmlParam> initParams, final List<Dispatcher> dispatchers); static void addFilterAtPosition(final FilterPosition filterPosition,
      final String afterFilterName, final String beforeFilterName, final String filterName,
      final String filterClass, final String urlPattern, final Document document,
      final String comment, final WebXmlParam... initParams); static void addListener(final String className, final Document document,
      final String comment); static void addSecurityConstraint(final String displayName,
      final List<WebResourceCollection> webResourceCollections, final List<String> roleNames,
      final String transportGuarantee, final Document document, final String comment); static void addServlet(final String servletName, final String className,
      final String urlPattern, final Integer loadOnStartup, final Document document,
      final String comment, final WebXmlParam... initParams); static void addWelcomeFile(final String path, final Document document, final String comment); static void setDescription(final String description, final Document document,
      final String comment); static void setDisplayName(final String displayName, final Document document,
      final String comment); static void setSessionTimeout(final int timeout, final Document document,
      final String comment);  }### Answer:
@Ignore @Test public void testAddErrorCode() { WebXmlUtils.addErrorCode(404, "/404", webXml, null); final Element errorPageElement = (Element) webXml.getDocumentElement().getChildNodes() .item(webXml.getDocumentElement().getChildNodes().getLength() - 1); assertNotNull(errorPageElement); assertEquals(2, errorPageElement.getChildNodes().getLength()); assertEquals("404", XmlUtils.findFirstElement("error-code", errorPageElement).getTextContent()); assertEquals("/404", XmlUtils.findFirstElement("location", errorPageElement).getTextContent()); }