
com.github.invictum.velocity.VelocityProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unified-test-junit Show documentation
Show all versions of unified-test-junit Show documentation
Integration with jUnit test framework. Based on Serenity BDD project.
The newest version!
package com.github.invictum.velocity;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.tools.generic.DateTool;
import org.apache.velocity.tools.generic.MathTool;
import java.io.StringWriter;
public class VelocityProcessor {
private static VelocityContext context = new VelocityContext();
static {
context.put("math", new MathTool());
context.put("date", new DateTool());
context.put("choose", new ChooseTool());
context.put("text", RandomStringUtils.class);
}
public static String processContent(String content) {
Velocity.init();
StringWriter writer = new StringWriter();
Velocity.evaluate(context, writer, "longTag", content);
return writer.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy