|
@@ -12,26 +12,48 @@ import java.util.TreeMap;
|
12
|
12
|
*/
|
13
|
13
|
public class PhoneBookTest {
|
14
|
14
|
|
15
|
|
- PhoneBook testPhonebook = new PhoneBook();
|
|
15
|
+//Start off here. google "how to write a test for a map"
|
|
16
|
+// PhoneBook testPhonebook = new PhoneBook(); <=why didn't this work?
|
|
17
|
+ PhoneBook testPhonebook;
|
16
|
18
|
|
17
|
19
|
@Before
|
|
20
|
+ public void setup() {
|
|
21
|
+ testPhonebook = new PhoneBook();
|
|
22
|
+ }
|
18
|
23
|
|
19
|
|
- public void setup(){
|
20
|
|
-
|
21
|
|
-//Start off here. google "how to write a test for a map"
|
|
24
|
+ @Test
|
|
25
|
+ public void addEntryTestCase1(){
|
|
26
|
+ new Person("Addison", "1234");
|
|
27
|
+ testPhonebook.add("Addison", "1234");
|
|
28
|
+ String testNumber = testPhonebook.lookup("Addison");
|
|
29
|
+ Assert.assertTrue(testNumber.equals("[1234]"));
|
|
30
|
+ }
|
22
|
31
|
|
|
32
|
+ @Test
|
|
33
|
+ public void addEntryTestCase2(){
|
|
34
|
+ new Person("AdDy", "123.4");
|
|
35
|
+ testPhonebook.add("AdDy", "123.4");
|
|
36
|
+ String testNumber = testPhonebook.lookup("AdDy");
|
|
37
|
+ Assert.assertTrue(testNumber.equals("[123.4]"));
|
23
|
38
|
}
|
24
|
39
|
|
|
40
|
+
|
|
41
|
+
|
25
|
42
|
@Test
|
26
|
43
|
public void testLookup() {
|
27
|
44
|
|
28
|
45
|
testPhonebook.add("JohnDoe", "1123");
|
29
|
46
|
|
30
|
|
- String expected = "1123";
|
|
47
|
+ String expected = "[1123]";
|
31
|
48
|
String actual = testPhonebook.lookup("JohnDoe");
|
32
|
49
|
|
33
|
50
|
Assert.assertEquals(expected, actual);
|
34
|
51
|
|
35
|
52
|
}
|
36
|
53
|
|
|
54
|
+ @Test
|
|
55
|
+ public void test (){
|
|
56
|
+
|
|
57
|
+ }
|
|
58
|
+
|
37
|
59
|
}
|