mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 20:30:52 +01:00
added unit test for freemarker template
This commit is contained in:
@@ -36,47 +36,25 @@ package sonia.scm.template;
|
||||
import com.github.mustachejava.DefaultMustacheFactory;
|
||||
import com.github.mustachejava.Mustache;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class MustacheTemplateTest
|
||||
public class MustacheTemplateTest extends TemplateTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Test
|
||||
public void testRender()
|
||||
@Override
|
||||
public Template getTemplate()
|
||||
{
|
||||
|
||||
DefaultMustacheFactory factory = new DefaultMustacheFactory();
|
||||
Mustache mustache = factory.compile("sonia/scm/template/001.mustache");
|
||||
|
||||
MustacheTemplate template =
|
||||
new MustacheTemplate("/sonia/scm/template/001.mustache", mustache);
|
||||
|
||||
Map<String, String> env = Maps.newHashMap();
|
||||
|
||||
env.put("name", "marvin");
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
template.execute(writer, env);
|
||||
|
||||
assertEquals("Hello marvin!", writer.toString());
|
||||
return new MustacheTemplate("sonia/scm/template/001.mustache", mustache);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user