IfMacro implements IMacroRunnable { @Override public String getHtml(IMacroContext macroContext) { String code = macroContext.getParameters(); if (StringUtils.isNotBlank(code)) { try { GroovyShell shell = getGroovyShell(macroContext); log.debug("evaluating expression: {}", code); Object result = shell.evaluate(code); if ((result instanceof Boolean) && ((Boolean) result).booleanValue()) { return macroContext.getBody(); } } catch (RuntimeException e) { log.error("error evaluating {{if}} expression", e); } } return null; }  @Override String getHtml(IMacroContext macroContext); @Override String cleanupHtml(String html);  }
@Test public void getHtml() { String html = macro.getHtml(context); assertEquals(BODY, html); assertEquals(PROJECT, projectName); assertEquals(BRANCH, branchName); assertEquals(PAGE, pagePath); }