String statement = "Some query syntax";
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, Query.XPATH);
Node node = query.storeAsNode("/storedQuery");
assertThat(node, is(notNullValue()));
assertThat(node.getPrimaryNodeType().getName(), is("nt:query"));
assertThat(node.getProperty("jcr:language").getString(), is(Query.XPATH));
assertThat(node.getProperty("jcr:statement").getString(), is(statement));
}