private static void assertParseError(String expressionString, String expectedError) {
        try {
            new DocumentSelector(expressionString);
            fail("The expression '" + expressionString + "' should throw an exception.");
        }
        catch (ParseException e) {
            Throwable t = e;
            if (t.getCause() instanceof TokenMgrException) {
                t = t.getCause();
            }
            assertEquals(expectedError, Exceptions.toMessageString(t).substring(0, expectedError.length()));
        }
    }
@author Simon Thoresen Hult
@author bratseth
document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java