/**
   * @see DATAGRAPH-632
   * @throws Exception
   */
  @Test
  public void testFindByMultipleNestedProperties() throws Exception {
    Filter planetNameFilter = new Filter();
    planetNameFilter.setNestedPropertyName("world");
    planetNameFilter.setNestedEntityTypeLabel("Planet");
    planetNameFilter.setPropertyValue("Earth");
    planetNameFilter.setPropertyName("name");
    planetNameFilter.setRelationshipType("ORBITS");
    planetNameFilter.setRelationshipDirection("OUTGOING");
    planetNameFilter.setComparisonOperator(ComparisonOperator.EQUALS);

    Filter planetMoonsFilter = new Filter();
    planetMoonsFilter.setNestedPropertyName("moons");
    planetMoonsFilter.setNestedEntityTypeLabel("Planet");
    planetMoonsFilter.setPropertyValue("Earth");
    planetMoonsFilter.setPropertyName("moons");
    planetMoonsFilter.setRelationshipType("ORBITS");
    planetMoonsFilter.setRelationshipDirection("OUTGOING");
    planetMoonsFilter.setBooleanOperator(BooleanOperator.AND);
    planetMoonsFilter.setComparisonOperator(ComparisonOperator.EQUALS);

    assertEquals(
        "MATCH (n:`Planet`) WHERE n.`name` = { `world_name` } AND n.`moons` = { `moons_moons` } MATCH (n)-[r:`ORBITS`]->(m) WITH n,r MATCH p=(n)-[*0..4]-() RETURN p, ID(r)",
        query
            .findByProperties("ORBITS", new Filters().add(planetNameFilter, planetMoonsFilter), 4)
            .getStatement());
  }
  /**
   * @see DATAGRAPH-632
   * @throws Exception
   */
  @Test
  public void testFindByBaseAndMultipleNestedPropertiesOnBothEnds() 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);

    Filter time = new Filter("time", 3600);
    time.setBooleanOperator(BooleanOperator.AND);

    assertEquals(
        "MATCH (n:`Moon`) WHERE n.`name` = { `world_name` } MATCH (m:`Planet`) WHERE m.`colour` = { `colour_colour` } 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(moonFilter, planetFilter, time), 4)
            .getStatement());
  }
 /**
  * @see DATAGRAPH-632
  * @throws Exception
  */
 @Test
 public void testFindByNestedPropertyIncoming() 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);
   assertEquals(
       "MATCH (m:`Planet`) WHERE m.`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());
 }