Package org.apache.struts.mock

Examples of org.apache.struts.mock.MockPageContext


        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

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.