|
@@ -22,36 +22,37 @@ public class PhoneBookTest {
|
22
|
22
|
// Given
|
23
|
23
|
PhoneBook testbook = new PhoneBook();
|
24
|
24
|
PhoneNumberStorage temp = new PhoneNumberStorage("Keith", "555-666-7777");
|
25
|
|
- testbook.add("Keith", temp);
|
|
25
|
+ testbook.addName("Keith", temp);
|
26
|
26
|
|
27
|
27
|
PhoneNumberStorage testNumber = testbook.lookup("Keith");
|
28
|
28
|
Assert.assertTrue(testNumber.equals(temp));
|
29
|
29
|
|
30
|
30
|
}
|
31
|
|
-//@Test
|
32
|
|
-// public void testPhoneBookDelete(){
|
33
|
|
-// PhoneBook testbook = new PhoneBook();
|
34
|
|
-// testbook.add("Keith", "555-666-7777");
|
35
|
|
-// testbook.deleter("Keith");
|
36
|
|
-// String testnumber = testbook.lookup("Keith");
|
37
|
|
-// Assert.assertEquals(null, testnumber);
|
38
|
|
-// }
|
39
|
|
-//@Test
|
40
|
|
-// public void testPhoneBookLookUp(){
|
41
|
|
-// PhoneBook testbook = new PhoneBook();
|
42
|
|
-// testbook.add("Keith", "555-666-7777");
|
43
|
|
-// String testnumber = testbook.lookup("Keith");
|
44
|
|
-// Assert.assertEquals("555-666-7777", testnumber);
|
45
|
|
-// }
|
|
31
|
+@Test
|
|
32
|
+ public void testPhoneBookDelete(){
|
|
33
|
+ PhoneBook testbook = new PhoneBook();
|
|
34
|
+ testbook.addName("Keith", "555-666-7777");
|
|
35
|
+ testbook.deleter("Keith");
|
|
36
|
+ PhoneNumberStorage temp = testbook.lookup("Keith");
|
|
37
|
+ Assert.assertNull(temp );
|
|
38
|
+ }
|
|
39
|
+@Test
|
|
40
|
+ public void testPhoneBookLookUp(){
|
|
41
|
+ PhoneBook testbook = new PhoneBook();
|
|
42
|
+ PhoneNumberStorage temp = new PhoneNumberStorage("Keith", "555-666-7777");
|
|
43
|
+ testbook.addName("Keith", temp);
|
|
44
|
+ PhoneNumberStorage actual = testbook.lookup("Keith");
|
|
45
|
+ Assert.assertEquals(actual, temp);
|
|
46
|
+ }
|
46
|
47
|
|
47
|
48
|
@Test
|
48
|
49
|
public void testPhoneBookList(){
|
49
|
50
|
|
50
|
51
|
PhoneBook testbook = new PhoneBook();
|
51
|
|
- testbook.add("Keith", "555-666-7777");
|
52
|
|
- testbook.add("John", "555-612-7777");
|
53
|
|
- testbook.add("Mike", "555-623-7777");
|
54
|
|
- testbook.add("Steve", "555-645-7777");
|
|
52
|
+ testbook.addName("Keith", "555-666-7777");
|
|
53
|
+ testbook.addName("John", "555-612-7777");
|
|
54
|
+ testbook.addName("Mike", "555-623-7777");
|
|
55
|
+ testbook.addName("Steve", "555-645-7777");
|
55
|
56
|
|
56
|
57
|
String expected = "John 555-612-7777\n" +
|
57
|
58
|
"Keith 555-666-7777\n" +
|
|
@@ -65,10 +66,10 @@ public class PhoneBookTest {
|
65
|
66
|
public void testPhoneBookNames(){
|
66
|
67
|
|
67
|
68
|
PhoneBook testbook = new PhoneBook();
|
68
|
|
- testbook.add("Keith", "555-666-7777");
|
69
|
|
- testbook.add("John", "555-612-7777");
|
70
|
|
- testbook.add("Mike", "555-623-7777");
|
71
|
|
- testbook.add("Steve", "555-645-7777");
|
|
69
|
+ testbook.addName("Keith", "555-666-7777");
|
|
70
|
+ testbook.addName("John", "555-612-7777");
|
|
71
|
+ testbook.addName("Mike", "555-623-7777");
|
|
72
|
+ testbook.addName("Steve", "555-645-7777");
|
72
|
73
|
|
73
|
74
|
String expected = "John\n" +
|
74
|
75
|
"Keith\n" +
|
|
@@ -80,10 +81,11 @@ public class PhoneBookTest {
|
80
|
81
|
@Test
|
81
|
82
|
public void testPhoneBookReverseLookUp() {
|
82
|
83
|
PhoneBook testbook = new PhoneBook();
|
83
|
|
- testbook.add("Keith", "555-666-7777");
|
84
|
|
- testbook.add("John", "555-612-7777");
|
85
|
|
- testbook.add("Mike", "555-623-7777");
|
86
|
|
- testbook.add("Steve", "555-645-7777");
|
|
84
|
+
|
|
85
|
+ testbook.addName("Keith", "555-666-7777");
|
|
86
|
+ testbook.addName("John", "555-612-7777");
|
|
87
|
+ testbook.addName("Mike", "555-623-7777");
|
|
88
|
+ testbook.addName("Steve", "555-645-7777");
|
87
|
89
|
String testnumber = testbook.reverselookup("555-666-7777");
|
88
|
90
|
Assert.assertEquals("Keith", testnumber);
|
89
|
91
|
}
|