@Test public void testIfCondition() { String template = "Hello {{ a }}{% if b %} and {{ b }}{% endif %}"; Map<String, Object> args = ImmutableMap.of("a", "XX"); assertEquals("Hello XX", TemplateProcessor.process(template, args)); args = ImmutableMap.of("a", "XX", "b", "YY"); assertEquals("Hello XX and YY", TemplateProcessor.process(template, args)); }
public static String process(String template, Map<String, Object> args) { return new TemplateProcessor(template).process(args); }
TemplateProcessor { public static String process(String template, Map<String, Object> args) { return new TemplateProcessor(template).process(args); } }
TemplateProcessor { public static String process(String template, Map<String, Object> args) { return new TemplateProcessor(template).process(args); } TemplateProcessor(String template); }
TemplateProcessor { public static String process(String template, Map<String, Object> args) { return new TemplateProcessor(template).process(args); } TemplateProcessor(String template); static String process(String template, Map<String, Object> args); String process(Map<String, Object> args); }
TemplateProcessor { public static String process(String template, Map<String, Object> args) { return new TemplateProcessor(template).process(args); } TemplateProcessor(String template); static String process(String template, Map<String, Object> args); String process(Map<String, Object> args);  }