Package com.atlassian.bamboo.freemarker
Class FreemarkerTestHelper
java.lang.Object
com.atlassian.bamboo.freemarker.FreemarkerTestHelper
Helper to write freemarker 'unit' tests
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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...
-
Constructor Details
-
FreemarkerTestHelper
public FreemarkerTestHelper()
-
-
Method Details
-
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
-