public void shouldHaveBestRuleAlwaysSetJoinAlgorithmToNestedLoopIfConditionIsDescendantNode() {
PlanNode join = new PlanNode(Type.JOIN, selector("Ancestor"), selector("Descendant"));
PlanNode ancestorSource = new PlanNode(Type.SOURCE, join, selector("Ancestor"));
PlanNode descendantSource = new PlanNode(Type.SOURCE, join, selector("Descendant"));
// Set the join type and condition ...
JoinCondition joinCondition = new DescendantNodeJoinCondition(selector("Ancestor"), selector("Descendant"));
join.setProperty(Property.JOIN_CONDITION, joinCondition);
join.setProperty(Property.JOIN_TYPE, JoinType.INNER);
// Execute the rule ...
PlanNode result = bestRule.execute(context, join, new LinkedList<OptimizerRule>());