Package org.apache.struts.mock

Examples of org.apache.struts.mock.MockPageContext


        // -- configure the request
        this.request = new MockHttpServletRequest(new MockHttpSession());

        pageContext =
            new MockPageContext(servletConfig, request,
                new MockHttpServletResponse());
    }
View Full Code Here


        MockHttpServletResponse mockHttpServletResponse =
            new MockHttpServletResponse();

        mockServletConfig.setServletContext(mockServletContext);

        MockPageContext mockPageContext =
            new MockPageContext(mockServletConfig, mockHttpServletRequest,
                mockHttpServletResponse);

        ModuleConfig foundModuleConfig = null;

        try {
            foundModuleConfig = tagutils.getModuleConfig(mockPageContext);
            fail("Expected ModuleConfig to not be found");
        } catch (NullPointerException ignore) {
            // expected result
        }

        mockHttpServletRequest.setAttribute(Globals.MODULE_KEY, moduleConfig);

        mockPageContext.getServletContext().setAttribute(Globals.MODULE_KEY,
            mockPageContext);

        foundModuleConfig = tagutils.getModuleConfig(mockPageContext);
        assertNotNull(foundModuleConfig);
    }
View Full Code Here

            // pass
        }
    }

    public void testWrite() {
        MockPageContext pg = new MockPageContext(false, false);

        try {
            tagutils.write(pg, null);
        } catch (JspException e) {
            fail("JspException should not have been thrown");
View Full Code Here

            fail("JspException should not have been thrown");
        }
    }

    public void testWriteThrowException() {
        MockPageContext pg = new MockPageContext(true, false);

        try {
            tagutils.write(pg, null);
            fail("JspException should have been thrown");
        } catch (JspException e) {
View Full Code Here

            // success
        }
    }

    public void testWritePrevious() {
        MockPageContext pg = new MockPageContext(false, false);

        try {
            tagutils.writePrevious(pg, null);
        } catch (JspException e) {
            fail("JspException should not have been thrown");
View Full Code Here

            fail("JspException should not have been thrown");
        }
    }

    public void testWritePreviousThrowException() {
        MockPageContext pg = new MockPageContext(true, false);

        try {
            tagutils.writePrevious(pg, null);
            fail("JspException should have been thrown");
        } catch (JspException e) {
View Full Code Here

            // success
        }
    }

    public void testWritePreviousBody() {
        MockPageContext pg = new MockPageContext(false, true);

        try {
            tagutils.writePrevious(pg, null);
        } catch (JspException e) {
            fail("JspException should not have been thrown");
View Full Code Here

    MockServletContext servlet = new JSOMockServletContext(mockSiteUrl);
    MockServletConfig config = new MockServletConfig(servlet);
    MockHttpSession session = new MockHttpSession(servlet);
    MockHttpServletRequest request = new MockHttpServletRequest("/JSOTest","/JSOUnit",null,null,session);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockPageContext pageContext = new JSOMockPageContext(config, request, response);
   
    return pageContext;
   
  }
View Full Code Here

        // -- configure the request
        this.request = new MockHttpServletRequest(new MockHttpSession());

        pageContext =
            new MockPageContext(servletConfig, request,
                new MockHttpServletResponse());
    }
View Full Code Here

     */
    public void setUp() {
        config      = new MockServletConfig();
        request     = new MockHttpServletRequest();
        response    = new MockHttpServletResponse();
        pageContext = new MockPageContext(config, request, response);
        htmlTag     = new HtmlTag();
        htmlTag.setPageContext(pageContext);
    }
View Full Code Here

TOP

Related Classes of org.apache.struts.mock.MockPageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.