Package play.templates

Examples of play.templates.GroovyTemplate.render()


    @Test
    public void testDynamicClassBindingWithNew() {
        final String source = "${ new TemplateClassBindingTest.StaticInnerClass().val }";
        GroovyTemplate groovyTemplate = new GroovyTemplate("dynamic_class_binding_with_new", source);
        new GroovyTemplateCompiler().compile(groovyTemplate);
        assertEquals("42", groovyTemplate.render());
    }

    @Test
    public void testDynamicClassBindingWithInstanceOf() {
        StaticInnerClass staticInnerClass = new StaticInnerClass();
View Full Code Here


        final String source = "${ staticInnerClass instanceof TemplateClassBindingTest.StaticInnerClass }";
        GroovyTemplate groovyTemplate = new GroovyTemplate("dynamic_class_binding_with_instanceof", source);
        new GroovyTemplateCompiler().compile(groovyTemplate);
        Map<String, Object> args = new HashMap<String,Object>();
        args.put("staticInnerClass", staticInnerClass);
        assertEquals("true", groovyTemplate.render(args));
    }

    @Test
    public void testDynamicClassBindingWithDotClass() {
        StaticInnerClass staticInnerClass = new StaticInnerClass();
View Full Code Here

        final String source = "${ staticInnerClass.getClass() == TemplateClassBindingTest.StaticInnerClass.class }";
        GroovyTemplate groovyTemplate = new GroovyTemplate("dynamic_class_binding_with_dot_class", source);
        new GroovyTemplateCompiler().compile(groovyTemplate);
        Map<String, Object> args = new HashMap<String,Object>();
        args.put("staticInnerClass", staticInnerClass);
        assertEquals("true", groovyTemplate.render(args));
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.