|
@@ -29,23 +29,44 @@ public class PhoneBookTest {
|
29
|
29
|
}
|
30
|
30
|
|
31
|
31
|
@Test
|
32
|
|
- public void testAdd() {
|
33
|
|
-
|
|
32
|
+ public void testInputEntry() {
|
34
|
33
|
//Given
|
35
|
34
|
PhoneBook book = new PhoneBook();
|
36
|
35
|
|
37
|
36
|
ArrayList<String> expectedAddition = new ArrayList<String>();
|
38
|
37
|
expectedAddition.add("302-555-2222");
|
39
|
38
|
expectedAddition.add("302-555-3456");
|
|
39
|
+
|
40
|
40
|
//When
|
41
|
41
|
book.inputEntry("Bob", expectedAddition);
|
42
|
42
|
ArrayList<String> actualAddition = new ArrayList<String>(book.lookup("Bob"));
|
43
|
43
|
|
44
|
44
|
//Then
|
45
|
45
|
Assert.assertEquals(expectedAddition, actualAddition);
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ @Test
|
|
49
|
+ public void addNumberToEntry() {
|
|
50
|
+ //Given
|
|
51
|
+ PhoneBook book = new PhoneBook();
|
|
52
|
+ ArrayList<String> bobNumber = new ArrayList<String>();
|
|
53
|
+ bobNumber.add("302-555-2222");
|
|
54
|
+ book.inputEntry("Bob", bobNumber);
|
|
55
|
+ book.display();
|
|
56
|
+ //Expected
|
|
57
|
+ ArrayList<String> expectedAddition = new ArrayList<String>();
|
|
58
|
+ expectedAddition.add("302-555-2222");
|
|
59
|
+ expectedAddition.add("302-555-1111");
|
|
60
|
+ //When
|
|
61
|
+ book.addNumberToEntry("Bob", "302-555-1111");
|
|
62
|
+ ArrayList<String> actualAddition = book.lookup("Bob");
|
|
63
|
+ //Then
|
|
64
|
+ Assert.assertEquals(expectedAddition, actualAddition);
|
46
|
65
|
|
47
|
66
|
}
|
48
|
67
|
|
|
68
|
+ //add test for removeNumberFromEntry
|
|
69
|
+
|
49
|
70
|
@Test
|
50
|
71
|
public void testRemoveEntry() {
|
51
|
72
|
|
|
@@ -129,6 +150,7 @@ public class PhoneBookTest {
|
129
|
150
|
String expectedName = "Bob";
|
130
|
151
|
ArrayList<String> bobNumber = new ArrayList<String>();
|
131
|
152
|
bobNumber.add("302-555-2223");
|
|
153
|
+ bobNumber.add("302-555-5555");
|
132
|
154
|
book.inputEntry(expectedName, bobNumber);
|
133
|
155
|
|
134
|
156
|
//When;
|