exceptionThrown = false; message = ""; try { result = queryAndAssert(service, "for $a in (<a/>, <b/>, doh, <c/>) return $a", -1, null); } catch (XMLDBException e) { exceptionThrown = true; message = e.getMessage(); } assertTrue("Exception wanted: " + message, exceptionThrown);
    public void testPathExpression() {        try {            XQueryService service =                 storeXMLStringAndGetQueryService("numbers.xml", numbers);             ResourceSet result;                        boolean exceptionThrown = false;            String message = "";            try {                result = queryAndAssert(service, "('a', 'b', 'c')/position()", -1, null);                            } catch (XMLDBException e) {                exceptionThrown = true;                message = e.getMessage();            }            assertTrue("Exception wanted: " + message, exceptionThrown);                        result = queryAndAssert(service, "()/position()", 0, null);                    } catch (XMLDBException e) {            fail(e.getMessage());        }    }    