assertTrue("Exception wanted: " + message, message.contains("XPTY0019"));
assertTrue("Exception wanted: " + message, message.indexOf("XPTY0019") > -1);
    public void testPathExpression() {        try {            XQueryService service =                 storeXMLStringAndGetQueryService("numbers.xml", numbers);                         //Invalid path expression left operand (not a node set).            boolean exceptionThrown = false;            String message = "";            try {                queryAndAssert(service, "('a', 'b', 'c')/position()", -1, null);                            } catch (XMLDBException e) {                exceptionThrown = true;                message = e.getMessage();            }            assertTrue("Exception wanted: " + message, message.contains("XPTY0019"));                        //Undefined context sequence            exceptionThrown = false;            message = "";            try {                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, message.contains("XPDY0002"));                         exceptionThrown = false;            message = "";            try {                //"1 to 2" is resolved as a (1, 2), i.e. a sequence of *integers* which is *not* a singleton                queryAndAssert(service, "let $a := (1, 2, 3) for $b in $a[1 to 2] return $b", -1, null);                            } catch (XMLDBException e) {                exceptionThrown = true;                message = e.getMessage();            }            //No effective boolean value for such a kind of sequence !            assertTrue("Exception wanted: " + message, message.contains("FORG0006"));                        queryAndAssert(service, "()/position()", 0, null);                    } catch (XMLDBException e) {            fail(e.getMessage());        }    }    