@SuppressWarnings("unchecked")
@Test
public void testInitialize() {

    ApplicationContext context = createMock(ApplicationContext.class);
    TilesContainer container = createMock(TilesContainer.class);
    Map<String, Object> scope = createMock(Map.class);
    expect(containerFactory.createContainer(context)).andReturn(container);
    expect(context.getApplicationScope()).andReturn(scope).anyTimes();
    expect(scope.put(ApplicationAccess.APPLICATION_CONTEXT_ATTRIBUTE,
            context)).andReturn(null);
    expect(scope.put(TilesAccess.CONTAINER_ATTRIBUTE, container)).andReturn(null);
    expect(scope.remove(TilesAccess.CONTAINER_ATTRIBUTE)).andReturn(container);
    replay(containerFactory, context, container, scope);
    initializer.initialize(context);
    initializer.destroy();
    verify(containerFactory, context, container, scope);
}