@Test
public void shouldPushDownAllSelectNodesThatApplyToOneSelectorToBelowAccessNodeForThatSelector() {

    // Each of the PROJECT, SELECT, and SELECT nodes must have the names of the selectors that they apply to ...
    PlanNode project = new PlanNode(Type.PROJECT, selector("Selector1"), selector("Selector2"));
    PlanNode select1 = new PlanNode(Type.SELECT, project, selector("Selector1"));
    PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("Selector2"));
    PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("Selector1"), selector("Selector2"));
    PlanNode select4 = new PlanNode(Type.SELECT, select3, selector("Selector1"));
    PlanNode join = new PlanNode(Type.JOIN, select4, selector("Selector1"), selector("Selector2"));
    PlanNode s1Access = new PlanNode(Type.ACCESS, join, selector("Selector1"));
    PlanNode s1Source = new PlanNode(Type.SOURCE, s1Access, selector("Selector1"));
    PlanNode s2Access = new PlanNode(Type.ACCESS, join, selector("Selector2"));
    PlanNode s2Source = new PlanNode(Type.SOURCE, s2Access, selector("Selector2"));
    // Set the join type ...
    join.setProperty(Property.JOIN_TYPE, JoinType.INNER);
    // Execute the rule ...
    PlanNode result = rule.execute(context, project, new LinkedList<OptimizerRule>());
    // System.out.println(result);
    assertThat(result, is(sameInstance(project)));
    assertChildren(project, select3);
    assertChildren(select3, join);
    assertChildren(join, s1Access, s2Access);
    assertChildren(s1Access, select1);
    assertChildren(select1, select4);
    assertChildren(select4, s1Source);
    assertChildren(s2Access, select2);
    assertChildren(select2, s2Source);
    assertChildren(s2Source);
    assertChildren(s1Source);
}