### Question:
BinaryExpr extends Expr { @Override public Expr getChild(int index) { if (index == 0) { return getLhs(); } if (index == 1) { return getRhs(); } throw new IndexOutOfBoundsException("Index for BinaryExpr must be 0 or 1"); } BinaryExpr(Expr lhs, Expr rhs, BinOp op); Expr getLhs(); void setLhs(Expr lhs); Expr getRhs(); void setRhs(Expr rhs); BinOp getOp(); @Override void accept(IAstVisitor visitor); @Override BinaryExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }### Answer:
@Test(expected = IndexOutOfBoundsException.class) public void getChildBad() { new BinaryExpr(new BoolConstantExpr(true), new BoolConstantExpr(false), BinOp.LXOR).getChild(2); }