@Test
public void shouldReplaceViewWithPlanForViewWithSingleTable() {

    // 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("v1"));
    PlanNode select1 = new PlanNode(Type.SELECT, project, selector("v1"));
    PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("v1"));
    PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("v1"));
    PlanNode source = new PlanNode(Type.SOURCE, select3, selector("v1"));
    source.setProperty(Property.SOURCE_NAME, selector("v1"));
    // Create the equivalent plan nodes for what should be created ...
    PlanNode viewProject = new PlanNode(Type.PROJECT, selector("t1"));
    PlanNode viewSelect = new PlanNode(Type.SELECT, viewProject, selector("t1"));
    PlanNode viewSource = new PlanNode(Type.SOURCE, viewSelect, selector("t1"));
    viewProject.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11"), column("t1", "c12")));
    viewSelect.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c13"),
                                                                    Operator.LESS_THAN, new Literal(3L)));
    viewSource.setProperty(Property.SOURCE_NAME, selector("t1"));
    viewSource.setProperty(Property.SOURCE_COLUMNS, schemata.getTable(selector("t1")).getColumns());
    // Execute the rule ...
    PlanNode result = rule.execute(context, project, new LinkedList<OptimizerRule>());
    // System.out.println(project);
    // System.out.println(result);
    assertThat(result.isSameAs(project), is(true));
    assertChildren(project, select1);
    assertChildren(select1, select2);
    assertChildren(select2, select3);
}