FileDocCategorySizeDatePackage
SubmitLogonActionCactusTest.javaAPI DocExample1246Wed Oct 13 21:52:52 BST 2004com.oreilly.strutsckbk.ch13

SubmitLogonActionCactusTest

public class SubmitLogonActionCactusTest extends servletunit.struts.CactusStrutsTestCase

Fields Summary
private static final String
ACTION_PATH
Constructors Summary
public SubmitLogonActionCactusTest(String testName)


       
        super(testName);
    
Methods Summary
public voidtestInvalidUserLogon()

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

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

        addRequestParameter("username", "usdder");
        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");