@FixFor( {"MODE-1277", "MODE-1485"} )

@Test
public void shouldBeAbleToCreateAndExecuteJcrSql2QueryWithFullOuterJoin() throws RepositoryException {
    String sql = "SELECT car.[jcr:name], category.[jcr:primaryType], car.[jcr:path], category.[jcr:path] from [car:Car] as car FULL OUTER JOIN [nt:unstructured] as category ON ISCHILDNODE(car,category) WHERE NAME(car) LIKE 'Toyota*'";
    Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
    QueryResult result = query.execute();
    String[] columnNames = {"car.jcr:name", "category.jcr:primaryType", "car.jcr:path", "category.jcr:path"};
    // Because every "Toyota" car has a parent, there will be no 'car' nodes that don't have a category. However,
    // we'll see every category node, and there are 25 of them. Therefore, we'll see 25 nodes.
    validateQuery().rowCount(25).hasColumns(columnNames).onEachRow(new Predicate() {
        @Override
        public void validate( int rowNumber,
                              Row row ) throws RepositoryException {
            // Every row should have a category ...
            assertNotNull(row.getNode("category"));
            // Every non-null car should be a Toyota ...
            Node car = row.getNode("car");
            if (car != null) assertTrue(car.getName().contains("Toyota"));
        }
    }).validate(query, result);
}