### Question:
IfTagHandler extends AbstractTagHandler { public void process(Node result, Element tag, TemplateProcessor processor) { Boolean condition = getValueFromTag(tag, CONDITION_ATTR, processor, Boolean.class); if (condition == null || !condition.booleanValue()) { return; } processor.processChildNodes(result, tag); } @Inject  IfTagHandler(); void process(Node result, Element tag, TemplateProcessor processor);  }### Answer:
@Test public void conditionIsFalse() throws Exception { Document doc = documentProvider.createDocument(null, null, null); Element tag = doc.createElement("if"); tag.setAttribute(IfTagHandler.CONDITION_ATTR, "fakeExpression"); processor.expressionResults = ImmutableMap.of("fakeExpression", false); replay(processor); handler.process(null, tag, processor); verify(processor); }
@Test public void conditionIsTrue() throws Exception { Document doc = documentProvider.createDocument(null, null, null); Element tag = doc.createElement("if"); tag.setAttribute(IfTagHandler.CONDITION_ATTR, "fakeExpression"); processor.expressionResults = ImmutableMap.of("fakeExpression", true); processor.processChildNodes((Node) isNull(), same(tag)); replay(processor); handler.process(null, tag, processor); verify(processor); }
@Test public void conditionIsMissing() throws Exception { Document doc = documentProvider.createDocument(null, null, null); Element tag = doc.createElement("if"); replay(processor); handler.process(null, tag, processor); verify(processor); }