-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserListTest.java
163 lines (146 loc) · 4.39 KB
/
UserListTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* @author Caleb Martin
*/
import static org.junit.jupiter.api.Assertions.*;
import java.util.UUID;
import org.junit.*;
import org.junit.jupiter.api.BeforeEach;
public class UserListTest
{
private static ChildList childList;
private static UserList userList;
@BeforeEach
public void setup(){
UserList.getInstance().addU("c1", "w1",
838, "[email protected]", "Love", "1/20/2021");
}
@BeforeClass
public static void oneTimeSetup()
{
UserList.getInstance().addUser(null);
childList = ChildList.getInstance();
userList = UserList.getInstance();
}
@Test
public void TestAdd(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "[email protected]", "Love", "1/20/2021");
assertTrue(test);
}
@Test
public void testAddNullFirstName(){
boolean test = UserList.getInstance().addU(null, "w1",
838, "[email protected]", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testAddNullLastName(){
boolean test = UserList.getInstance().addU("c1", null,
838, "[email protected]", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testAddNullNumber(){
boolean test = UserList.getInstance().addU("c1", "w1",
813, "[email protected]", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testAddNullEmail(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, null, "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testAddNullPassword(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "[email protected]", null, "1/20/2021");
assertFalse(test);
}
@Test
public void testAddNullBirthday(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "[email protected]", "Love", null);
assertFalse(test);
}
@Test
public void testEmptyFirstName(){
boolean test = UserList.getInstance().addU("", "w1",
838, "[email protected]", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testEmptyLastName(){
boolean test = UserList.getInstance().addU("c1", "",
838, "[email protected]", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testEmptyEmail(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "", "Love", "1/20/2021");
assertFalse(test);
}
@Test
public void testEmptyPassWord(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "[email protected]", "", "1/20/2021");
assertFalse(test);
}
@Test
public void testEmptyDateOfBirth(){
boolean test = UserList.getInstance().addU("c1", "w1",
838, "[email protected]", "Love", "");
assertFalse(test);
}
@Test
public void TestTest(){
User testUser = new User("Test", "User", 0, "null", "null", "null");
userList.addUser(testUser);
assertEquals(testUser, userList.getUser(testUser.getUUID()));
}
@Test
public void testGetInstance()
{
assertNotNull(userList);
}
@Test
public void testDataAfterGetInstance()
{
assertNotNull(userList.getUsers());
}
@Test
public void testListHasUsers()
{
assertNotEquals(0, userList.getUsers().size());
}
@Test
public void testGetReadUser()
{
assertNotNull(userList.getUser(UUID.fromString("16c7e243-f077-4246-9695-0f9662eda176")));
}
@Test
public void testGetStaffUser()
{
assertNotNull(userList.getStaffUser(UUID.fromString("fa7cdb87-0440-4c51-bf70-f390eb99d99e")));
}
@Test
public void getUser(){
assertNotNull(userList.getUser(UUID.fromString("fa7cdb87-0440-4c51-bf70-f390eb99d99e")));
}
@Test
public void testUserListManipulation()
{
User testUser = new User("Test", "User", 0, "null", "null", "null");
userList.addUser(testUser);
assertEquals(testUser, userList.getUser(testUser.getUUID()));
}
@Test
public void testAddNull()
{
/*int userListSize = userList.getUsers().size();
userList.addUser(null);
assertNotEquals(userListSize+1, userList.getUsers().size());*/
assertTrue(false); //Test fails, and messes up testGetReadUser in the process.
}
}