VelocityUtil { @SuppressWarnings("unchecked") public static Map<String, Object> getParameters(InternalContextAdapter context, Node node) { ASTMap astMap = (ASTMap) node.jjtGetChild(0); Map<String, Object> params = (Map<String, Object>) astMap .value(context); return params; } private  VelocityUtil(); @SuppressWarnings("unchecked") static Map<String, Object> getParameters(InternalContextAdapter context,
            Node node); static Object getObject(Object value, Object defaultValue);  }
@Test public void testGetParameters() { InternalContextAdapter context = createMock(InternalContextAdapter.class); Node node = createMock(Node.class); ASTMap astMap = createMock(ASTMap.class); @SuppressWarnings("unchecked") Map<String, Object> params = createMock(Map.class); expect(node.jjtGetChild(0)).andReturn(astMap); expect(astMap.value(context)).andReturn(params); replay(context, node, astMap, params); assertSame(params, VelocityUtil.getParameters(context, node)); verify(context, node, astMap, params); }