final MockHttpServletRequest request = new MockHttpServletRequest();
final MockHttpServletResponse response = new MockHttpServletResponse();
final PortalControlStructures portalControlStructures = new PortalControlStructures(request, response);
final IPortletDefinitionId portDef1 = new MockPortletDefinitionId("portDef1");
final IPortletDefinition portletDefinition = createMock(IPortletDefinition.class);
expect(portletDefinition.getPortletDefinitionId()).andReturn(portDef1);
final IPortletDefinitionRegistry portletDefinitionRegistry = createMock(IPortletDefinitionRegistry.class);
expect(portletDefinitionRegistry.getPortletDefinition(1)).andReturn(portletDefinition);
final IPortletEntity portletEntity = createMock(IPortletEntity.class);
final IPortletEntityRegistry portletEntityRegistry = createMock(IPortletEntityRegistry.class);
expect(portletEntityRegistry.getOrCreatePortletEntity(portDef1, "sub1", 1)).andReturn(portletEntity);
final IPortletWindowId portletWindowId = new MockPortletWindowId("win1");
final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
final IPortletRenderer portletRenderer = createMock(IPortletRenderer.class);
expect(portletRenderer.doInit(portletEntity, null, portalControlStructures.getHttpServletRequest(), response))
.andReturn(portletWindowId);
this.springPortletChannel.setPortletDefinitionRegistry(portletDefinitionRegistry);
this.springPortletChannel.setPortletEntityRegistry(portletEntityRegistry);