VelocityAutotagRuntime extends Directive implements AutotagRuntime<Request> { @Override public ModelBody createModelBody() { ASTBlock block = (ASTBlock) node.jjtGetChild(1); return new VelocityModelBody(context, block, writer); }  @Override Request createRequest(); @Override ModelBody createModelBody(); @Override @SuppressWarnings("unchecked") T getParameter(String name, Class<T> type, T defaultValue); @Override String getName(); @Override int getType(); @Override boolean render(InternalContextAdapter context, Writer writer, Node node);  }
@Test public void testCreateModelBody() { InternalContextAdapter context = createMock(InternalContextAdapter.class); Writer writer = createMock(Writer.class); Node node = createMock(Node.class); ASTBlock block = createMock(ASTBlock.class); expect(node.jjtGetChild(1)).andReturn(block); replay(context, writer, node, block); VelocityAutotagRuntime runtime = new VelocityAutotagRuntime(); runtime.render(context, writer, node); ModelBody modelBody = runtime.createModelBody(); assertTrue(modelBody instanceof VelocityModelBody); verify(context, writer, node, block); }