// mock test PortletWindow, PortletEntity, PortletDefinition and PortletApplication
Mock entityMock = new Mock(MutablePortletEntity.class);
Mock portletDefinitionMock = new Mock(PortletDefinition.class);
Mock portletApplicationMock = new Mock(PortletApplication.class);
Mock windowListMock = new Mock(CompositeWindowList.class);
PortletWindowListCtrl windowList = (PortletWindowListCtrl)windowListMock.proxy();
entityMock.expects(new AnyArgumentsMatcher()).method("getPortletWindowList").withNoArguments().will(new ReturnStub(windowList));
windowListMock.expects(new AnyArgumentsMatcher()).method("add").withAnyArguments().will(new VoidStub());
portletApplicationMock.expects(new AnyArgumentsMatcher()).method("getId").withNoArguments().will(new ReturnStub(new JetspeedLongObjectID(1)));
portletDefinitionMock.expects(new AnyArgumentsMatcher()).method("getPortletApplicationDefinition").withNoArguments().will(new ReturnStub(portletApplicationMock.proxy()));
entityMock.expects(new AnyArgumentsMatcher()).method("getPortletDefinition").withNoArguments().will(new ReturnStub(portletDefinitionMock.proxy()));