FileDocCategorySizeDatePackage
SubmitLogonActionTest.javaAPI DocExample1307Tue Oct 12 23:13:32 BST 2004com.oreilly.strutsckbk.ch13

SubmitLogonActionTest

public class SubmitLogonActionTest extends servletunit.struts.MockStrutsTestCase

Fields Summary
private static final String
ACTION_PATH
Constructors Summary
public SubmitLogonActionTest(String theName)

    
        
        super(theName);
    
Methods Summary
public voidtestInvalidUserLogon()

        addRequestParameter("username", "junk");
        addRequestParameter("password", "bond");

        setRequestPathInfo(ACTION_PATH);
        actionPerform();
        
        verifyActionErrors(new String[] {"error.password.mismatch"});
        
        verifyForward("logon");
        //verifyInputForward();
    
public voidtestValidUserLogon()

        addRequestParameter("username", "user");
        addRequestParameter("password", "pass");

        setRequestPathInfo(ACTION_PATH);
        actionPerform();
    
        verifyNoActionErrors();
        
        User user = (User) getSession().getAttribute(Constants.USER_KEY);
        assertNotNull("User", user);
        assertEquals("Username", "user", user.getUsername());

        verifyForward("success");