@SuppressWarnings("deprecation")
@Test
public void testRegisterAttributeRenderers() {

    BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
    ServletApplicationContext applicationContext = createMock(ServletApplicationContext.class);
    TilesContainer container = createMock(TilesContainer.class);
    AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
    ServletContext servletContext = createMock(ServletContext.class);
    rendererFactory.registerRenderer(eq("string"), isA(StringRenderer.class));
    rendererFactory.registerRenderer(eq("template"), isA(DispatchRenderer.class));
    rendererFactory.registerRenderer(eq("definition"), isA(DefinitionRenderer.class));
    rendererFactory.registerRenderer(eq("freemarker"), isA(FreemarkerRenderer.class));
    rendererFactory.registerRenderer(eq("velocity"), isA(VelocityRenderer.class));
    rendererFactory.registerRenderer(eq("mustache"), isA(MustacheRenderer.class));
    expect(applicationContext.getContext()).andReturn(servletContext).anyTimes();
    expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY)).andReturn(null);
    expect(servletContext.getInitParameter(VelocityView.TOOLS_KEY)).andReturn(null);
    expect(servletContext.getAttribute(VelocityView.TOOLS_KEY)).andReturn(null);
    expect(servletContext.getResourceAsStream("/WEB-INF/velocity.properties")).andReturn(
            getClass().getResourceAsStream("/velocity.properties"));
    expect(servletContext.getResourceAsStream("/WEB-INF/VM_global_library.vm")).andReturn(
            getClass().getResourceAsStream("/VM_global_library.vm"));
    expect(servletContext.getResourceAsStream("/WEB-INF/tools.xml")).andReturn(
            getClass().getResourceAsStream("/tools.xml"));
    expect(servletContext.getResourceAsStream(VelocityView.DEPRECATED_USER_TOOLS_PATH)).andReturn(null);
    servletContext.log((String) anyObject());
    expectLastCall().anyTimes();
    expect(servletContext.getRealPath("/")).andReturn(null);
    replay(rendererFactory, applicationContext, container, attributeEvaluatorFactory, servletContext);
    factory.registerAttributeRenderers(rendererFactory, applicationContext, container, attributeEvaluatorFactory);
    verify(rendererFactory, applicationContext, container, attributeEvaluatorFactory, servletContext);
}