FunctionCallExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index < 0 || index >= getNumArgs()) { throw new IndexOutOfBoundsException("FunctionCallExpr has no child at index " + index); } args.set(index, expr); } FunctionCallExpr(String callee, List<Expr> args);  FunctionCallExpr(String callee, Expr... args); String getCallee(); void setCallee(String callee); List<Expr> getArgs(); int getNumArgs(); Expr getArg(int index); void setArg(int index, Expr expr); void removeArg(int index); @Override void accept(IAstVisitor visitor); @Override FunctionCallExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }
@Test public void setChild() throws Exception { fce.setChild(0, arg4); fce.setChild(1, arg3); fce.setChild(2, arg2); fce.setChild(3, arg1); assertEquals(arg4, fce.getArg(0)); assertEquals(arg3, fce.getArg(1)); assertEquals(arg2, fce.getArg(2)); assertEquals(arg1, fce.getArg(3)); }
@Test(expected = IndexOutOfBoundsException.class) public void setChildBad() { fce.setChild(4, arg1); }