@Test public void testServeResource() throws Exception { MockResourceRequest request = new MockResourceRequest(); MockResourceResponse response = new MockResourceResponse(); PortalPropertiesPrettierPortlet portlet = createMockBuilder( PortalPropertiesPrettierPortlet.class).addMockedMethod( "prettify", PortletRequest.class).createMock(); String expected = "expected"; expect(portlet.prettify(request)).andReturn(expected); replay(portlet); portlet.serveResource(request, response); Assert.assertEquals(expected, response.getContentAsString()); verify(portlet); }
public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); OutputStream out = response.getPortletOutputStream(); IOUtils.copy(new StringReader(prettyProperties), out); IOUtils.closeQuietly(out); }
PortalPropertiesPrettierPortlet extends MVCPortlet { public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); OutputStream out = response.getPortletOutputStream(); IOUtils.copy(new StringReader(prettyProperties), out); IOUtils.closeQuietly(out); } }
PortalPropertiesPrettierPortlet extends MVCPortlet { public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); OutputStream out = response.getPortletOutputStream(); IOUtils.copy(new StringReader(prettyProperties), out); IOUtils.closeQuietly(out); }  }
PortalPropertiesPrettierPortlet extends MVCPortlet { public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); OutputStream out = response.getPortletOutputStream(); IOUtils.copy(new StringReader(prettyProperties), out); IOUtils.closeQuietly(out); }  void prettify(ActionRequest request, ActionResponse response); void serveResource(ResourceRequest request, ResourceResponse response); @Reference(unbind = "-") void setPortalPropertiesPrettier(PortalPropertiesPrettier prettier); }
PortalPropertiesPrettierPortlet extends MVCPortlet { public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { String prettyProperties = prettify(request); OutputStream out = response.getPortletOutputStream(); IOUtils.copy(new StringReader(prettyProperties), out); IOUtils.closeQuietly(out); }  void prettify(ActionRequest request, ActionResponse response); void serveResource(ResourceRequest request, ResourceResponse response); @Reference(unbind = "-") void setPortalPropertiesPrettier(PortalPropertiesPrettier prettier);  }