@Test public void testExecuteTag() throws JspException, MethodInvocationException, ResourceNotFoundException, ParseErrorException, IOException { InternalContextAdapter context = createMock(InternalContextAdapter.class); Node node = createMock(Node.class); PageContext pageContext = createMock(PageContext.class); BodyTag tag = createMock(BodyTag.class); ASTBlock block = createMock(ASTBlock.class); JspWriter writer = createMock(JspWriter.class); expect(tag.doStartTag()).andReturn(BodyTag.EVAL_BODY_BUFFERED); tag.setBodyContent(isA(VelocityBodyContent.class)); tag.doInitBody(); expect(node.jjtGetChild(1)).andReturn(block); expect(tag.doAfterBody()).andReturn(BodyTag.SKIP_BODY); expect(tag.doEndTag()).andReturn(BodyTag.EVAL_PAGE); expect(pageContext.getOut()).andReturn(writer); expect(block.render(eq(context), isA(StringWriter.class))).andReturn(true); replay(context, node, pageContext, block, tag, writer); JspUtils.executeTag(context, node, pageContext, tag); verify(context, node, pageContext, block, tag, writer); }
public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException { int result = tag.doStartTag(); if (tag instanceof BodyTag) { BodyTag bodyTag = (BodyTag) tag; BodyContent bodyContent = new VelocityBodyContent( pageContext.getOut(), (ASTBlock) node.jjtGetChild(1), context); switch (result) { case BodyTag.EVAL_BODY_BUFFERED: bodyTag.setBodyContent(bodyContent); bodyTag.doInitBody(); case BodyTag.EVAL_BODY_INCLUDE: bodyContent.getString(); default: break; } while (bodyTag.doAfterBody() == BodyTag.EVAL_BODY_AGAIN) { bodyContent.getString(); } } tag.doEndTag(); }
JspUtils { public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException { int result = tag.doStartTag(); if (tag instanceof BodyTag) { BodyTag bodyTag = (BodyTag) tag; BodyContent bodyContent = new VelocityBodyContent( pageContext.getOut(), (ASTBlock) node.jjtGetChild(1), context); switch (result) { case BodyTag.EVAL_BODY_BUFFERED: bodyTag.setBodyContent(bodyContent); bodyTag.doInitBody(); case BodyTag.EVAL_BODY_INCLUDE: bodyContent.getString(); default: break; } while (bodyTag.doAfterBody() == BodyTag.EVAL_BODY_AGAIN) { bodyContent.getString(); } } tag.doEndTag(); } }
JspUtils { public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException { int result = tag.doStartTag(); if (tag instanceof BodyTag) { BodyTag bodyTag = (BodyTag) tag; BodyContent bodyContent = new VelocityBodyContent( pageContext.getOut(), (ASTBlock) node.jjtGetChild(1), context); switch (result) { case BodyTag.EVAL_BODY_BUFFERED: bodyTag.setBodyContent(bodyContent); bodyTag.doInitBody(); case BodyTag.EVAL_BODY_INCLUDE: bodyContent.getString(); default: break; } while (bodyTag.doAfterBody() == BodyTag.EVAL_BODY_AGAIN) { bodyContent.getString(); } } tag.doEndTag(); }  }
JspUtils { public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException { int result = tag.doStartTag(); if (tag instanceof BodyTag) { BodyTag bodyTag = (BodyTag) tag; BodyContent bodyContent = new VelocityBodyContent( pageContext.getOut(), (ASTBlock) node.jjtGetChild(1), context); switch (result) { case BodyTag.EVAL_BODY_BUFFERED: bodyTag.setBodyContent(bodyContent); bodyTag.doInitBody(); case BodyTag.EVAL_BODY_INCLUDE: bodyContent.getString(); default: break; } while (bodyTag.doAfterBody() == BodyTag.EVAL_BODY_AGAIN) { bodyContent.getString(); } } tag.doEndTag(); }  static void setLatestTag(Context context, JspTag tag); static JspTag getLatestJspTag(Context context); static Tag wrapTag(JspTag tag); static void executeSimpleTag(InternalContextAdapter context,
            Node node, PageContext pageContext, SimpleTag tag); static void executeTag(InternalContextAdapter context, Node node,
            PageContext pageContext, Tag tag); }
JspUtils { public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException { int result = tag.doStartTag(); if (tag instanceof BodyTag) { BodyTag bodyTag = (BodyTag) tag; BodyContent bodyContent = new VelocityBodyContent( pageContext.getOut(), (ASTBlock) node.jjtGetChild(1), context); switch (result) { case BodyTag.EVAL_BODY_BUFFERED: bodyTag.setBodyContent(bodyContent); bodyTag.doInitBody(); case BodyTag.EVAL_BODY_INCLUDE: bodyContent.getString(); default: break; } while (bodyTag.doAfterBody() == BodyTag.EVAL_BODY_AGAIN) { bodyContent.getString(); } } tag.doEndTag(); }  static void setLatestTag(Context context, JspTag tag); static JspTag getLatestJspTag(Context context); static Tag wrapTag(JspTag tag); static void executeSimpleTag(InternalContextAdapter context,
            Node node, PageContext pageContext, SimpleTag tag); static void executeTag(InternalContextAdapter context, Node node,
            PageContext pageContext, Tag tag);  }