### Question:
OrderedQueryMetadata extends DefaultQueryMetadata { @Override public void addJoin(JoinType joinType, Expression<?> expr) { joins = null; super.addJoin(joinType, expr); } OrderedQueryMetadata(); @Override void addJoin(JoinType joinType, Expression<?> expr); @Override List<JoinExpression> getJoins();  }### Answer:
@Test public void addJoin() { List<JoinExpression> joins = new ArrayList<JoinExpression>(); joins.add(new JoinExpression(JoinType.DEFAULT, x)); joins.add(new JoinExpression(JoinType.DEFAULT, y)); joins.add(new JoinExpression(JoinType.INNERJOIN, y)); joins.add(new JoinExpression(JoinType.INNERJOIN, x_a)); joins.add(new JoinExpression(JoinType.INNERJOIN, x_a_a)); joins.add(new JoinExpression(JoinType.INNERJOIN, x_a_b)); joins.add(new JoinExpression(JoinType.INNERJOIN, x_b)); joins.add(new JoinExpression(JoinType.INNERJOIN, y_a)); joins.add(new JoinExpression(JoinType.INNERJOIN, y_b)); for (JoinExpression join1 : joins) { for (JoinExpression join2 : joins) { QueryMetadata md = new OrderedQueryMetadata(); addJoin(md, join1); addJoin(md, join2); validate(md.getJoins()); for (JoinExpression join3 : joins) { md = new OrderedQueryMetadata(); addJoin(md, join1); addJoin(md, join2); addJoin(md, join3); validate(md.getJoins()); for (JoinExpression join4 : joins) { md = new OrderedQueryMetadata(); addJoin(md, join1); addJoin(md, join2); addJoin(md, join3); addJoin(md, join4); validate(md.getJoins()); } } } } }