final IUserLayoutChannelDescription userLayoutChannelDescription = createMock(IUserLayoutChannelDescription.class);
final IPortletDefinitionRegistry portletDefinitionRegistry = createMock(IPortletDefinitionRegistry.class);
final IPortletDefinition portletDefinition = createMock(IPortletDefinition.class);
final IChannelDefinition channelDefinition = createMock(IChannelDefinition.class);
final IPerson person = createMock(IPerson.class);
final IPortletEntityRegistry portletEntityRegistry = createMock(IPortletEntityRegistry.class);
final IPortletEntity portletEntity = createMock(IPortletEntity.class);
final IPortletWindow portletWindow = createMock(IPortletWindow.class);
final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("42");
final MockPortletEntityId portletEntityId = new MockPortletEntityId("subId1");
final MockPortletWindowId portletWindowId = new MockPortletWindowId("windowId1");
expect(userInstanceManager.getUserInstance(request)).andReturn(userInstance);
expect(userInstance.getPreferencesManager()).andReturn(userPreferencesManager);
expect(userPreferencesManager.getUserLayoutManager()).andReturn(userLayoutManager);
expect(userLayoutManager.getSubscribeId("my-info-student-center-home")).andReturn("subId1");
expect(userLayoutManager.getNode("subId1")).andReturn(userLayoutChannelDescription);
expect(userLayoutChannelDescription.getChannelPublishId()).andReturn("42");
expect(portletDefinitionRegistry.getPortletDefinition(42)).andReturn(portletDefinition);
expect(portletDefinition.getChannelDefinition()).andReturn(channelDefinition);
expect(channelDefinition.isPortlet()).andReturn(true);
expect(userInstance.getPerson()).andReturn(person);
expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
expect(person.getID()).andReturn(37);
expect(portletEntityRegistry.getOrCreatePortletEntity(portletDefinitionId, "subId1", 37)).andReturn(portletEntity);
expect(portletEntity.getPortletEntityId()).andReturn(portletEntityId);
expect(portletWindowRegistry.createDefaultPortletWindow(request, portletEntityId)).andReturn(portletWindow);
expect(portletWindow.getPortletWindowId()).andReturn(portletWindowId);
expect(portletWindowRegistry.createTransientPortletWindowId(request, portletWindowId)).andReturn(portletWindowId);