Code example for AssertionFailedError

Methods: initCause

    static class Context { 
        private final InputSource inputSource;
        private final String url;
        private final String select;
        Context(InputSource inputSource, String url, String select) {
            this.inputSource = inputSource;
            this.url = url;
   = select;
        Node getNode() {
            XPath xpath = XPathFactory.newInstance().newXPath();
            try { 
                return (Node) xpath.evaluate(select, inputSource, XPathConstants.NODE);
            } catch (XPathExpressionException e) {
                Error error = new AssertionFailedError("Failed to get context");
                throw error;
Experience pair programming with AI  Get Codota for Java