Package com.samskivert.velocity

Source Code of com.samskivert.velocity.VelocityTest

//
// samskivert library - useful routines for java programs
// Copyright (C) 2001-2012 Michael Bayne, et al.
// http://github.com/samskivert/samskivert/blob/master/COPYING

package com.samskivert.velocity;

import java.io.StringWriter;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;

import org.junit.*;
import static org.junit.Assert.*;

/**
* Tests some Velocity stuff.
*/
public class VelocityTest
{
    @Test
    public void testClasspathLoader ()
        throws Exception
    {
        VelocityContext ctx = new VelocityContext();
        ctx.put("foo", "bar");

        StringWriter writer = new StringWriter();
        VelocityEngine engine = VelocityUtil.createEngine();
        engine.mergeTemplate("velocity/test.tmpl", "UTF-8", ctx, writer);

        assertTrue(writer.toString().trim().equals("Hello bar."));
    }
}
TOP

Related Classes of com.samskivert.velocity.VelocityTest

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.