PortalPropertiesPrettierPortlet extends MVCPortlet { public void prettify(ActionRequest request, ActionResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); request.setAttribute("portalPrettyProperties", prettyProperties); }  void prettify(ActionRequest request, ActionResponse response); void serveResource(ResourceRequest request, ResourceResponse response); @Reference(unbind = "-") void setPortalPropertiesPrettier(PortalPropertiesPrettier prettier);  }
@Test public void testPrettifyActionRequestActionResponse() throws Exception { MockActionRequest request = new MockActionRequest(); MockActionResponse response = new MockActionResponse(); PortalPropertiesPrettierPortlet portlet = createMockBuilder( PortalPropertiesPrettierPortlet.class).addMockedMethod( "prettify", PortletRequest.class).createMock(); String expected = "expected"; expect(portlet.prettify(request)).andReturn(expected); replay(portlet); portlet.prettify(request, response); Assert.assertEquals(expected, request.getAttribute("portalPrettyProperties")); verify(portlet); }