UserDefinedFunction f = (UserDefinedFunction) UserDefinedFunctionFactory.getFactory().create("http://example/cube");
f.build("http://example/cube", new ExprList(new NodeValueInteger(2)));
Expr actual = f.getActualExpr();
NodeValue result = actual.eval(BindingFactory.create(), FunctionEnvBase.createTest());
Assert.assertEquals(8, NodeFactoryExtra.nodeToInt(result.asNode()));
//Change the definition of the function we depend on
//This has no effect with preserveDependencies set to false (the default) since we fully expanded the call to the dependent
//function when our outer function was defined
square = new ExprVar("x");
UserDefinedFunctionFactory.getFactory().add("http://example/square", square, new ArrayList<>(square.getVarsMentioned()));
f.build("http://example/cube", new ExprList(new NodeValueInteger(2)));
actual = f.getActualExpr();
result = actual.eval(BindingFactory.create(), FunctionEnvBase.createTest());
Assert.assertEquals(8, NodeFactoryExtra.nodeToInt(result.asNode()));
}