package com.jamesmurty.utils;

public class TestXMLBuilder2 extends BaseXMLBuilderTests {

    @Override
    public Class<? extends BaseXMLBuilder> XMLBuilderToTest() throws Exception {
        return XMLBuilder2.class;
    }

    @Override
    protected boolean isRuntimeExceptionsOnly() {
        return true;
    }

}

@@ -24,16 +24,105 @@
 utils;%0A%0A
+import javax.xml.xpath.XPathConstants;%0Aimport javax.xml.xpath.XPathExpressionException;%0A%0A
 public c
@@ -401,10 +401,1052 @@
 %0A    %7D%0A%0A
+    // NOTE: No checked exceptions for API calls made in this test method%0A    public void testNoCheckedExceptions() %7B%0A        XMLBuilder2 builder = XMLBuilder2.create(%22Blah%22);%0A        builder = XMLBuilder2.parse(EXAMPLE_XML_DOC);%0A        builder.stripWhitespaceOnlyTextNodes();%0A        builder.asString();%0A        builder.elementAsString();%0A        builder.xpathQuery(%22/*%22, XPathConstants.NODESET);%0A        builder.xpathFind(%22/Projects%22);%0A    %7D%0A%0A    public void testExceptionWrappedInXMLBuilderRuntimeException() %7B%0A        XMLBuilder2 builder = XMLBuilder2.parse(EXAMPLE_XML_DOC);%0A        try %7B%0A            builder.xpathFind(%22/BadPath%22);%0A            fail(%22Expected XMLBuilderRuntimeException%22);%0A        %7D catch (XMLBuilderRuntimeException e) %7B%0A            assertEquals(XMLBuilderRuntimeException.class, e.getClass());%0A            Throwable cause = e.getCause();%0A            assertEquals(XPathExpressionException.class, cause.getClass());%0A            assertTrue(cause.getMessage().contains(%22does not resolve to an Element%22));%0A        %7D%0A    %7D%0A%0A
 %7D%0A

Add unit tests for XMLBuilder2 exception wrapping feature, re #4