/**
  * @see DATAGRAPH-632
  * @throws Exception
  */
 @Test
 public void testFindByPropertiesOred() throws Exception {
   Filter distance = new Filter("distance", 60.2);
   Filter time = new Filter("time", 3600);
   time.setBooleanOperator(BooleanOperator.OR);
   assertEquals(
       "MATCH (n)-[r:`ORBITS`]->(m) WHERE r.`distance` = { `distance` } OR r.`time` = { `time` } WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
       query.findByProperties("ORBITS", new Filters().add(distance, time), 4).getStatement());
 }
 /**
  * @see DATAGRAPH-632
  * @throws Exception
  */
 @Test
 public void testFindByPropertiesWithDifferentComparisonOperatorsAnded() throws Exception {
   Filter distance = new Filter("distance", 60.2);
   distance.setComparisonOperator(ComparisonOperator.LESS_THAN);
   Filter time = new Filter("time", 3600);
   time.setBooleanOperator(BooleanOperator.AND);
   assertEquals(
       "MATCH (n)-[r:`ORBITS`]->(m) WHERE r.`distance` < { `distance` } AND r.`time` = { `time` } WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
       query.findByProperties("ORBITS", new Filters().add(distance, time), 4).getStatement());
 }
 /**
  * @see DATAGRAPH-632
  * @throws Exception
  */
 @Test
 public void testFindByBaseAndNestedPropertyIncoming() throws Exception {
   Filter planetFilter = new Filter();
   planetFilter.setNestedPropertyName("world");
   planetFilter.setNestedEntityTypeLabel("Planet");
   planetFilter.setPropertyValue("Earth");
   planetFilter.setPropertyName("name");
   planetFilter.setRelationshipType("ORBITS");
   planetFilter.setRelationshipDirection("INCOMING");
   planetFilter.setComparisonOperator(ComparisonOperator.EQUALS);
   Filter time = new Filter("time", 3600);
   time.setBooleanOperator(BooleanOperator.AND);
   assertEquals(
       "MATCH (m:`Planet`) WHERE m.`name` = { `world_name` } MATCH (n)-[r:`ORBITS`]->(m) WHERE r.`time` = { `time` } WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
       query.findByProperties("ORBITS", new Filters().add(planetFilter, time), 4).getStatement());
 }
 /**
  * @see DATAGRAPH-632
  * @throws Exception
  */
 @Test
 public void testFindByNestedPropertyOutgoing() throws Exception {
   Filter planetFilter = new Filter();
   planetFilter.setNestedPropertyName("world");
   planetFilter.setNestedEntityTypeLabel("Planet");
   planetFilter.setPropertyValue("Earth");
   planetFilter.setPropertyName("name");
   planetFilter.setRelationshipType("ORBITS");
   planetFilter.setRelationshipDirection("OUTGOING");
   planetFilter.setComparisonOperator(ComparisonOperator.EQUALS);
   assertEquals(
       "MATCH (n:`Planet`) WHERE n.`name` = { `world_name` } MATCH (n)-[r:`ORBITS`]->(m) WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
       query.findByProperties("ORBITS", new Filters().add(planetFilter), 4).getStatement());
 }
  /**
   * @see DATAGRAPH-632
   * @throws Exception
   */
  @Test
  public void testFindByMultipleNestedPropertiesOnBothEnds() throws Exception {
    Filter moonFilter = new Filter();
    moonFilter.setNestedPropertyName("world");
    moonFilter.setNestedEntityTypeLabel("Moon");
    moonFilter.setPropertyValue("Earth");
    moonFilter.setPropertyName("name");
    moonFilter.setRelationshipType("ORBITS");
    moonFilter.setRelationshipDirection("OUTGOING");
    moonFilter.setComparisonOperator(ComparisonOperator.EQUALS);

    Filter planetFilter = new Filter();
    planetFilter.setNestedPropertyName("colour");
    planetFilter.setNestedEntityTypeLabel("Planet");
    planetFilter.setPropertyValue("Red");
    planetFilter.setPropertyName("colour");
    planetFilter.setRelationshipType("ORBITS");
    planetFilter.setRelationshipDirection("INCOMING");
    planetFilter.setComparisonOperator(ComparisonOperator.EQUALS);

    assertEquals(
        "MATCH (n:`Moon`) WHERE n.`name` = { `world_name` } MATCH (m:`Planet`) WHERE m.`colour` = { `colour_colour` } MATCH (n)-[r:`ORBITS`]->(m) WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
        query
            .findByProperties("ORBITS", new Filters().add(moonFilter, planetFilter), 4)
            .getStatement());
  }