@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); }