Package de.odysseus.el.tree.impl

Examples of de.odysseus.el.tree.impl.Builder


import junit.framework.TestCase;

public class NodePrinterTest extends TestCase {

  public void testDump() throws IOException {
    Tree tree = new Builder(Feature.METHOD_INVOCATIONS).build("${foo.bar[baz] + foobar}");
    StringWriter writer = new StringWriter();
    NodePrinter.dump(new PrintWriter(writer), tree.getRoot());
    String[] expected = {
        "+- ${...}",
        "   |",
View Full Code Here


    context.getELResolver().setValue(context, null, "var111", new int[]{1,1,1});
    context.getELResolver().setValue(context, null, "var111s", new String[]{"1","1","1"});
  }

  public void testVarargs() {
    Builder builder = new Builder(Feature.VARARGS);
    Tree tree = null;

    tree = builder.build("${vararg:f()}");
    assertEquals(foovar(), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(1)}");
    assertEquals(foovar(1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(1,1)}");
    assertEquals(foovar(1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(null)}");
    assertEquals(foovar(0), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(var111)}");
    assertEquals(foovar(1,1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), context));

    tree = builder.build("${vararg:f(var111s)}");
    assertEquals(foovar(1,1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), context));
  }
View Full Code Here

TOP

Related Classes of de.odysseus.el.tree.impl.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.