Package com.atlassian.bamboo.freemarker
Class FreemarkerTestHelper
- java.lang.Object
-
- com.atlassian.bamboo.freemarker.FreemarkerTestHelper
-
public class FreemarkerTestHelper extends Object
Helper to write freemarker 'unit' tests
-
-
Constructor Summary
Constructors Constructor Description FreemarkerTestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static freemarker.template.Configuration
createTestingConfiguration(Class<?> clazz, String template)
Create FreeMarker testing configurationstatic String
runFreemarkerMacro(Class<?> clazz, Map datamodel, String template, String macro, String macroParams)
Process a template macro using FreeMarker and return the results If template has some 'not macro' code it will be run anyway...
-
-
-
Method Detail
-
createTestingConfiguration
public static freemarker.template.Configuration createTestingConfiguration(Class<?> clazz, String template) throws 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:
IOException
-
runFreemarkerMacro
public static String runFreemarkerMacro(Class<?> clazz, Map datamodel, String template, String macro, String macroParams) throws 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:
Exception
- if processing went wrong
-
-