01: package com.mockrunner.example.struts;
02:
03: /**
04: * Mock implementation of {@link AuthenticationStrategy}
05: * because we do not want a database connection into the tests.
06: * Used by {@link AuthenticationActionTest}.
07: */
08: public class MockAuthenticationStrategy implements
09: AuthenticationStrategy {
10: private boolean isLoginOk;
11: private boolean isUserKnown;
12: private boolean isPasswordOk;
13:
14: public void setupLoginOk(boolean isLoginOk) {
15: this .isLoginOk = isLoginOk;
16: }
17:
18: public void setupPasswordOk(boolean isPasswordOk) {
19: this .isPasswordOk = isPasswordOk;
20: }
21:
22: public void setupUserKnown(boolean isUserKnown) {
23: this .isUserKnown = isUserKnown;
24: }
25:
26: public boolean authenticate(String username, String password) {
27: return isLoginOk;
28: }
29:
30: public boolean wasLastPasswordOk() {
31: return isPasswordOk;
32: }
33:
34: public boolean wasLastUserKnown() {
35: return isUserKnown;
36: }
37: }
|