|
@@ -33,10 +33,8 @@ public class PhoneBookTest {
|
33
|
33
|
String actualPersonPhoneNumber = expectedPerson.phoneNumberList.get(0);
|
34
|
34
|
|
35
|
35
|
boolean actualPersonNameExists = this.phonebook.hashMap.containsKey("Jane");
|
36
|
|
- //boolean actualPhoneNumberExists = this.phonebook.hashMap.get("Jane").phoneNumberList.get(0);
|
37
|
36
|
|
38
|
37
|
Assert.assertTrue(actualPersonNameExists);
|
39
|
|
- //Assert.assertTrue(actualPhoneNumberExists);
|
40
|
38
|
}
|
41
|
39
|
|
42
|
40
|
|
|
@@ -72,30 +70,37 @@ public class PhoneBookTest {
|
72
|
70
|
Assert.assertFalse(actualPersonObject);
|
73
|
71
|
}
|
74
|
72
|
|
75
|
|
- /*
|
76
|
73
|
@Test
|
77
|
|
- public void getEntryListTest() {
|
78
|
|
- this.phonebook.addEntry("Ava", "(000) 111-2222");
|
79
|
|
- this.phonebook.addEntry("Brian", "(222) 333-4444");
|
80
|
|
- this.phonebook.addEntry("Charlie", "(444) 555-6666");
|
81
|
|
- this.phonebook.addEntry("David", "(666) 777-8888");
|
82
|
|
- this.phonebook.addEntry("Edward", "(777) 888-9999");
|
83
|
|
- this.phonebook.addEntry("Frank", "(888) 999-0000");
|
84
|
|
-
|
85
|
|
- Assert.assertNotNull(this.phonebook.getEntryList());
|
|
74
|
+ public void getKeySetTest() {
|
|
75
|
+ this.phonebook.addEntry("Frank", "(000) 000-0000", "(100) 000-0000");
|
|
76
|
+ this.phonebook.addEntry("Gabriel", "(100) 000-0000", "(110) 000-0000");
|
86
|
77
|
|
87
|
|
- /*
|
88
|
|
- this.phonebook.removeEntry("Bob");
|
|
78
|
+ System.out.println("getAllEntriesTest:");
|
|
79
|
+ String expectedKeySet = "[Gabriel, Frank]";
|
|
80
|
+ String actualKeySet = this.phonebook.getKeySet().toString();
|
89
|
81
|
|
90
|
|
- boolean actualPersonName = this.phonebook.hashMap.containsKey("Bob");
|
91
|
|
- boolean actualPersonObject = this.phonebook.hashMap.containsValue(this.phonebook.hashMap.get("Bob"));
|
|
82
|
+ Assert.assertEquals(expectedKeySet, actualKeySet);
|
|
83
|
+ }
|
92
|
84
|
|
93
|
|
- Assert.assertFalse(actualPersonName);
|
94
|
|
- Assert.assertFalse(actualPersonObject);
|
95
|
|
- */
|
96
|
|
- /*
|
|
85
|
+ @Test
|
|
86
|
+ public void displayAllEntriesTest() {
|
|
87
|
+ this.phonebook.addEntry("Herbert", "(200) 000-0000", "(210) 000-0000");
|
|
88
|
+ this.phonebook.addEntry("Isabel", "(300) 000-0000", "(310) 000-0000");
|
|
89
|
+
|
|
90
|
+ String expectedEntries = "Isabel" + "\n" +
|
|
91
|
+ "\t" + "(300) 000-0000" + "\n" +
|
|
92
|
+ "\t" + "(310) 000-0000" + "\n" +
|
|
93
|
+ "Herbert" + "\n" +
|
|
94
|
+ "\t" + "(200) 000-0000" + "\n" +
|
|
95
|
+ "\t" + "(210) 000-0000" + "\n";
|
|
96
|
+ String actualEntries = this.phonebook.displayAllEntries().toString();
|
|
97
|
+
|
|
98
|
+// System.out.println("displayAllEntriesTest:");
|
|
99
|
+// System.out.println(expectedEntries);
|
|
100
|
+// System.out.println(actualEntries);
|
|
101
|
+
|
|
102
|
+ Assert.assertEquals(expectedEntries, actualEntries);
|
97
|
103
|
}
|
98
|
|
- */
|
99
|
104
|
|
100
|
105
|
@Test
|
101
|
106
|
public void reverseLookupTest() {
|
|
@@ -112,9 +117,6 @@ public class PhoneBookTest {
|
112
|
117
|
String expectedName = "Ava";
|
113
|
118
|
String expectedPhoneNumber = "(000) 111-2222";
|
114
|
119
|
|
115
|
|
- //String actualNameFromPerson = expectedPerson.getName();
|
116
|
|
- //String actualPhoneNumberFromPerson = expectedPerson.getPhoneNumber();
|
117
|
|
-
|
118
|
120
|
String actualNameFromPhoneBook = "Ava";
|
119
|
121
|
boolean actualPhoneNumberFromPhoneBook = this.phonebook.hashMap.get(actualNameFromPhoneBook).phoneNumberList.contains(expectedPhoneNumber);
|
120
|
122
|
|