Java 类org.springframework.mock.web.portlet.MockResourceRequest 实例源码

项目:portal-properties-prettier-app    文件:PortalPropertiesPrettierPortletTest.java   
@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);
}