bindings = tree.bind(null, context.getVariableMapper());
assertNotNull(getNode(tree).getValueReference(bindings, context));
}
public void testInvoke() {
Tree tree = null;
Bindings bindings = null;
tree = parse("${bad}");
bindings = tree.bind(null, context.getVariableMapper());
try { getNode(tree).invoke(bindings, context, long.class, new Class[0], null); fail(); } catch (ELException e) {}
tree = parse("${var_method_1}");
bindings = tree.bind(null, context.getVariableMapper());
assertEquals(1l, getNode(tree).invoke(bindings, context, long.class, new Class[0], null));
tree = parse("${property_method_1}");
bindings = tree.bind(null, context.getVariableMapper());
assertEquals(1l, getNode(tree).invoke(bindings, context, null, new Class[0], null));
// no return type - ok
assertEquals(1l, getNode(tree).invoke(bindings, context, long.class, new Class[0], null));
// bad return type
try { getNode(tree).invoke(bindings, context, int.class, new Class[0], null); fail(); } catch (ELException e) {}
// bad arg types
try { getNode(tree).invoke(bindings, context, long.class, new Class[]{String.class}, null); fail(); } catch (ELException e) {}
// bad args
try { getNode(tree).invoke(bindings, context, long.class, new Class[0], new Object[]{""}); fail(); } catch (ELException e) {}
tree = parse("${var_method_1_expr}");
bindings = tree.bind(null, context.getVariableMapper());
assertEquals(1l, getNode(tree).invoke(bindings, context, long.class, new Class[0], null));
tree = parse("${property_method_1_expr}");
bindings = tree.bind(null, context.getVariableMapper());
assertEquals(1l, getNode(tree).invoke(bindings, context, null, new Class[0], null));
}