com.atlassian.bamboo.freemarker
Class FreemarkerTestHelper
java.lang.Object
com.atlassian.bamboo.freemarker.FreemarkerTestHelper
public class FreemarkerTestHelper
- extends java.lang.Object
Helper to write freemarker 'unit' tests
Method Summary |
static freemarker.template.Configuration |
createTestingConfiguration(java.lang.Class<?> clazz,
java.lang.String template)
Create FreeMarker testing configuration |
static java.lang.String |
runFreemarkerMacro(java.lang.Class<?> clazz,
java.util.Map datamodel,
java.lang.String template,
java.lang.String macro,
java.lang.String macroParams)
Process a template macro using FreeMarker and return the results
If template has some 'not macro' code it will be run anyway... |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FreemarkerTestHelper
public FreemarkerTestHelper()
createTestingConfiguration
public static freemarker.template.Configuration createTestingConfiguration(java.lang.Class<?> clazz,
java.lang.String template)
throws java.io.IOException
- Create FreeMarker testing configuration
- Parameters:
clazz
- class to get classloader from for loading templatestemplate
- example template to be loaded with this configuration (to detect if it's run locally)
- Returns:
- freemarker configuration
- Throws:
java.io.IOException
runFreemarkerMacro
public static java.lang.String runFreemarkerMacro(java.lang.Class<?> clazz,
java.util.Map datamodel,
java.lang.String template,
java.lang.String macro,
java.lang.String macroParams)
throws java.lang.Exception
- Process a template macro using FreeMarker and return the results
If template has some 'not macro' code it will be run anyway...
- Parameters:
clazz
- class to get classloader from for loading templatesdatamodel
- FreeMarker contexttemplate
- template file namemacro
- macro name in templatemacroParams
- call parameters of macro
- Returns:
- result of macro processing
- Throws:
java.lang.Exception
- if processing went wrong
Copyright © 2014 Atlassian Software Systems Pty Ltd. All Rights Reserved.