@Test
public void insensitiveToCase() throws Exception {

    String queryString = "select * WHERE { ?x ?Y ?z }";
    String queryNoSpaces = "select*WHERE{?x?Y?z}";
    Sparql11Parser parser = Query.getParser(queryString);
    TokenStream tokens = parser.getTokenStream();
    parser.addErrorListener(new BaseErrorListener() {
        @Override
        public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
            throw new IllegalStateException("failed to parse at line " + line + " due to " + msg, e);
        }
    });
    assertEquals(queryNoSpaces, parser.query().selectQuery().getText());
    assertEquals(queryString, tokens.getText());
}