VariableIdentifierExpr extends Expr { @Override public void setChild(int index, Expr expr) { throw new IndexOutOfBoundsException("VariableIdentifierExpr has no children"); } VariableIdentifierExpr(String name); String getName(); void setName(String name); @Override void accept(IAstVisitor visitor); @Override VariableIdentifierExpr clone(); @Override boolean hasChild(IAstNode child); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }
@Test(expected = IndexOutOfBoundsException.class) public void setChild() throws Exception { VariableIdentifierExpr x = new VariableIdentifierExpr("x"); x.setChild(0, null); }