@Test
public void testRightPush() throws IOException {

    OperatorNode<SequenceOperator> query = OperatorNode.create(SequenceOperator.FILTER,
            OperatorNode.create(SequenceOperator.JOIN,
                    OperatorNode.create(SequenceOperator.SCAN, ImmutableList.of("left"), Lists.newArrayList()).putAnnotation("alias", "left"),
                    OperatorNode.create(SequenceOperator.SCAN, ImmutableList.of("right"), Lists.newArrayList()).putAnnotation("alias", "right"),
                    OperatorNode.create(ExpressionOperator.EQ,
                            OperatorNode.create(ExpressionOperator.PROPREF, OperatorNode.create(ExpressionOperator.READ_RECORD, "left"), "id"),
                            OperatorNode.create(ExpressionOperator.PROPREF, OperatorNode.create(ExpressionOperator.READ_RECORD, "right"), "id"))
            ),
            OperatorNode.create(ExpressionOperator.EQ,
                    OperatorNode.create(ExpressionOperator.PROPREF, OperatorNode.create(ExpressionOperator.READ_RECORD, "right"), "id"),
                    OperatorNode.create(ExpressionOperator.LITERAL, "1"))
    );
    OperatorNode<SequenceOperator> transformed = new JoinFilterPushDown().visitSequenceOperator(query);
    Assert.assertEquals(transformed.getOperator(), SequenceOperator.JOIN);
    Assert.assertEquals(((OperatorNode) transformed.getArgument(0)).getOperator(), SequenceOperator.SCAN);
    Assert.assertEquals(((OperatorNode) transformed.getArgument(1)).getOperator(), SequenceOperator.FILTER);
    // TODO: validate the rest of the tree
}