-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserTest.java
86 lines (74 loc) · 2.54 KB
/
UserTest.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
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*;
/**
* A program Team Project
*
* <p>Purdue University -- CS18000 -- Spring 2024 -- Team Project-- </p>
*
* @author Purdue CS
* @version Mar 31, 2024
*/
public class UserTest {
@Test
public void testGetUsername() {
User user = new User("username", "password");
assertEquals("username", user.getUsername());
}
@Test
public void testGetPassword() {
User user = new User("username", "password");
assertEquals("password", user.getPassword());
}
@Test
public void testGetFollowing() {
User user1 = new User("username1", "password1");
User user2 = new User("username2", "password2");
user1.addFollowing(user2);
assertTrue(user1.getFollowing().contains(user2));
}
@Test
public void testAddFollowing() {
User user1 = new User("username1", "password1");
User user2 = new User("username2", "password2");
user1.addFollowing(user2);
assertTrue(user1.getFollowing().contains(user2));
}
@Test
public void testSetName() {
User user = new User("username", "password");
user.setName("newUsername");
assertEquals("newUsername", user.getUsername());
}
@Test
public void testRemoveFollowing() {
User user1 = new User("username1", "password1");
User user2 = new User("username2", "password2");
user1.addFollowing(user2);
user1.removeFollowing(user2);
assertFalse(user1.getFollowing().contains(user2));
}
@Test
public void testGetProfile() throws ProfileIncompleteException {
User user = new User("username", "password");
Profile profile = new Profile("about", new ArrayList<>(),
"education", "awards", "skills", "status");
user.setProfile(profile);
assertEquals(profile, user.getProfile());
}
@Test
public void testSetProfile() throws ProfileIncompleteException {
User user = new User("username", "password");
Profile profile = new Profile("about", new ArrayList<>(),
"education", "awards", "skills", "status");
user.setProfile(profile);
assertEquals(profile, user.getProfile());
}
@Test
public void testAddFollower() {
User user1 = new User("username1", "password1");
User user2 = new User("username2", "password2");
user1.addFollower(user2);
assertTrue(user2.getFollowing().contains(user1));
}
}