@SuppressWarnings( "deprecation" )
@Test
public void shouldBeAbleToExecuteXPathQueryToFindAllUnstructuredNodesOrderedByPropertyValue() throws RepositoryException {

    QueryManager manager = session.getWorkspace().getQueryManager();
    Query query = manager.createQuery("//element(*,nt:unstructured) order by @jcr:primaryType", Query.XPATH);
    QueryResult result = query.execute();
    validateQuery().rowCount(24).hasColumns("jcr:primaryType", "jcr:path", "jcr:score").validate(query, result);
    query = manager.createQuery("//element(*,car:Car) order by @car:year", Query.XPATH);
    result = query.execute();
    validateQuery().rowCount(13).hasColumns("car:year", "jcr:path", "jcr:score").validate(query, result);
}