/
FacePamphletProfileTest.java
159 lines (132 loc) · 4.51 KB
/
FacePamphletProfileTest.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
import static org.junit.Assert.*;
import java.text.SimpleDateFormat;
import java.util.*;
import org.junit.Test;
import acm.graphics.*;
public class FacePamphletProfileTest {
@Test
public void testGetName() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
assertTrue(test.getName().equals("Test Profile"));
}
@Test
public void testGetImage() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
GImage testImage = new GImage("test");
test.setImage(testImage);
assertTrue(test.getImage().equals(testImage));
}
@Test
public void testSetImage() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
GImage testImage = new GImage("test");
test.setImage(testImage);
assertEquals(testImage, test.getImage());
}
@Test
public void testGetStatus() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
test.setStatus("Busy");
assertTrue(test.getStatus().equals("Busy"));
}
@Test
public void testSetStatus() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
test.setStatus("Busy");
assertEquals("Busy", test.getStatus());
}
@Test
public void testGetBirthday() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
test.setBirthday(1,8);
assertTrue(test.getBirthdayMonth()==1 && test.getBirthdayDate()==8);
}
@Test
public void testSetBirthday() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
test.setBirthday(2,7);
assertTrue(test.getBirthdayMonth()==2 && test.getBirthdayDate()==7);
}
@Test
public void testAddFriend() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy");
test.addFriend(jimmy);
//assertEquals(1, test.getFriends().size());
String friend = test.getFriends().get(0);
assertEquals("Jimmy", friend);
}
@Test
public void testRemoveFriend() {
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy");
test.addFriend(jimmy);
test.removeFriend(jimmy.getName());
assertEquals(0, test.getFriends().size());
}
@Test
public void testGetFriendsOf()
{
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy");
FacePamphletProfile timmy = new FacePamphletProfile("Timmy");
FacePamphletProfile mom = new FacePamphletProfile("Your Mother");
test.addFriend(jimmy);
jimmy.addFriend(timmy);
jimmy.addFriend(mom);
ArrayList<String> testList = new ArrayList<String>();
testList.add("Timmy");
testList.add("Your Mother");
assertEquals(testList, test.getFriendsOf(jimmy));
}
@Test
public void testGetSecondOrderFriends()
{
FacePamphletDatabase theBase = new FacePamphletDatabase();
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy");
FacePamphletProfile timmy = new FacePamphletProfile("Timmy");
FacePamphletProfile shimmy = new FacePamphletProfile("Shimmy");
FacePamphletProfile joseph = new FacePamphletProfile("Joseph");
FacePamphletProfile mom = new FacePamphletProfile("Your Mother");
theBase.addProfile(test);
theBase.addProfile(jimmy);
theBase.addProfile(timmy);
theBase.addProfile(shimmy);
theBase.addProfile(joseph);
theBase.addProfile(mom);
jimmy.addFriend(timmy);
jimmy.addFriend(mom);
timmy.addFriend(shimmy);
timmy.addFriend(joseph);
timmy.addFriend(timmy);
test.addFriend(jimmy);
test.addFriend(timmy);
ArrayList<String> testList = new ArrayList<String>();
testList.add("Timmy");
testList.add("Shimmy");
testList.add("Joseph");
testList.add("Your Mother");
assertEquals(testList, test.getSecondOrderFriends());
}
@Test
public void testAddBirthdayNotification()
{
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy");
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat formatter= new SimpleDateFormat("MM/dd");
String dateNow = formatter.format(currentDate.getTime());
jimmy.setBirthday(12,4);
test.addFriend(jimmy);
test.addBirthdayNotifications();
assertTrue(test.getNotifications().contains("Jimmy's birthday is coming up on 12/4!!"));
}
@Test
public void createSubProfileTest()
{
FacePamphletProfile test = new FacePamphletProfile("Test Profile");
test.createSubProfile("Kitty");
assertTrue(test.getSubProfile().getName().equals("Kitty"));
}
}