Announcement

Collapse
No announcement yet.

Struts 2.0 testen mit JUnit

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Struts 2.0 testen mit JUnit

    Hi...
    hat jemand schon mal Struts 2.0 getestet mit JUnit...
    mein Problem sind die Interceptoren...

    siehe Code:

    public class LoginActionTest extends BaseStrutsTestCase {

    private Log log;

    public LoginActionTest(String name) {
    super(name);
    log = LogFactory.getLog(this.getClass());
    }

    public void testValidation () throws Exception {

    LoginAction action = createAction(LoginAction.class, "/", "Login");
    action.setUsername("admin");
    assertEquals(action.getUsername(),"admin");
    action.setPassword("default");
    assertEquals(action.getPassword(),"default");
    String result = proxy.execute();
    HashMap ses = new HashMap();
    action.setSession(ses);

    action.submit(); <-------- Geht nicht wegen dem Interceptor !!!!
    assertEquals(result, "SUCCESS");




    if(result.equals("error")) {
    log.error((String)servletContext.getAttribute(Cons tants.ERROR_MESSAGE));
    Collection c = action.getActionErrors();
    Iterator it = c.iterator();
    while (it.hasNext()) {
    log.info((String)it.next());
    }
    }

    }
    }



    Vielleicht kann mir ja jemand helfen ...

    Gruß und danke im voraus...


    Alsch
Working...
X