Skip to content

Commit e6e3cd0

Browse files
committed
minor changes
1 parent 09b8d6a commit e6e3cd0

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

src/main/java/screens/user_registration_screen/UserRegistrationUI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static void main(String[] args){
8585
UserLoginInputBoundary userLoginInteractor = new UserLoginInteractor(testDB);
8686
UserVerificationOutputBoundary loginUI = new UserLoginUI(userLoginInteractor);
8787
UserVerificationInputBoundary verificationInteractor = new UserVerificationInteractor(testDB, loginUI);
88-
UserExistsOutputBoundary verificationScreen = new UserVerificationScreen(verificationInteractor, new verificationMethodFactory());
88+
UserExistsOutputBoundary verificationScreen = new UserVerificationScreen(verificationInteractor);
8989
UserExistsInputBoundary existsInteractor = new UserExistsInteractor(testDB, verificationScreen);
9090
UserRegistrationUI testUI = new UserRegistrationUI(existsInteractor);
9191
testUI.getUserCredentials();

src/main/java/screens/user_registration_screen/UserVerificationScreen.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010

1111
public class UserVerificationScreen implements UserExistsOutputBoundary, ActionListener {
1212
private final JTextField verText = new JTextField(20);
13-
private final verificationMethodFactory deliveryMethod;
14-
private UserVerificationInputBoundary verificationInputBoundary;
13+
private final UserVerificationInputBoundary verificationInputBoundary;
1514
private int code;
1615
private String username;
1716
private String password;
1817
private String email;
1918

20-
public UserVerificationScreen(UserVerificationInputBoundary verificationInputBoundary, verificationMethodFactory deliveryMethod){
19+
public UserVerificationScreen(UserVerificationInputBoundary verificationInputBoundary){
2120
this.verificationInputBoundary = verificationInputBoundary;
22-
this.deliveryMethod = deliveryMethod;
2321
};
2422

2523
@Override
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package test_user_registration;
2+
3+
import data_access.Database;
4+
import entities.user_entities.User;
5+
import org.junit.jupiter.api.Test;
6+
import use_cases.user_registration_use_cases.UserExistsOutputBoundary;
7+
8+
public class TestUserExistsInputBoundary {
9+
@Test
10+
public void invalidCredentials(){
11+
//Anonymous class
12+
Database testDB = new Database() {
13+
@Override
14+
public User getUser(String username) {
15+
return null;
16+
}
17+
18+
@Override
19+
public void createUser(String username, String password, String email, String type) {
20+
}
21+
22+
@Override
23+
public boolean UserExists(String username, String email) {
24+
return false;
25+
}
26+
27+
@Override
28+
public boolean UserExists(String username) {
29+
return false;
30+
}
31+
};
32+
//Anonymous class for outputBoundary
33+
UserExistsOutputBoundary outputBoundary = new UserExistsOutputBoundary() {
34+
public int x;
35+
@Override
36+
public void getVerificationCredentials() {
37+
x += 1;
38+
}
39+
40+
@Override
41+
public void presentUserExistsMessage() {
42+
x += 3;
43+
}
44+
45+
@Override
46+
public void getCode(int code) {
47+
x += 5;
48+
}
49+
50+
@Override
51+
public void getUserCredentials(String username, String password, String email) {
52+
x += 6;
53+
}
54+
};
55+
56+
57+
58+
59+
60+
}
61+
}

0 commit comments

Comments
 (0)