@Test void testGenerateScript() { Script script = mock(Script.class); when(script.getContent()).thenReturn("Hey ${name}"); Map<String, Object> parameterValues = Collections.singletonMap("name", "Piet"); String renderedScript = ScriptUtils.generateScript(script, parameterValues); assertEquals("Hey Piet", renderedScript); }
public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(VERSION)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new GenerateScriptException( "Error processing parameters for script [" + script.getName() + "]. " + e.getMessage()); } return stringWriter.toString(); }
ScriptUtils { public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(VERSION)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new GenerateScriptException( "Error processing parameters for script [" + script.getName() + "]. " + e.getMessage()); } return stringWriter.toString(); } }
ScriptUtils { public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(VERSION)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new GenerateScriptException( "Error processing parameters for script [" + script.getName() + "]. " + e.getMessage()); } return stringWriter.toString(); } private  ScriptUtils(); }
ScriptUtils { public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(VERSION)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new GenerateScriptException( "Error processing parameters for script [" + script.getName() + "]. " + e.getMessage()); } return stringWriter.toString(); } private  ScriptUtils(); static String generateScript(Script script, Map<String, Object> parameterValues); static boolean hasScriptVariable(Script script, String variable); static Set<String> getScriptVariables(Script script); }
ScriptUtils { public static String generateScript(Script script, Map<String, Object> parameterValues) { StringWriter stringWriter = new StringWriter(); try { Template template = new Template(null, new StringReader(script.getContent()), new Configuration(VERSION)); template.process(parameterValues, stringWriter); } catch (TemplateException | IOException e) { throw new GenerateScriptException( "Error processing parameters for script [" + script.getName() + "]. " + e.getMessage()); } return stringWriter.toString(); } private  ScriptUtils(); static String generateScript(Script script, Map<String, Object> parameterValues); static boolean hasScriptVariable(Script script, String variable); static Set<String> getScriptVariables(Script script);  }