Browse Source

started not finished, confused

Katrice Williams-Dredden 6 years ago
parent
commit
f16d77ee56

+ 51
- 0
src/main/java/com/zipcodewilmington/phonebook/PhoneBook.java View File

@@ -4,4 +4,55 @@ package com.zipcodewilmington.phonebook;
4 4
  * Created by leon on 1/23/18.
5 5
  */
6 6
 public class PhoneBook {
7
+
8
+    private String name;
9
+    private String number;
10
+
11
+    //the instance of the phone book (ask about this, not 1000% clear
12
+    public Person(String name, String phoneNumber) {
13
+        this.name = name;
14
+        this.phoneNumber = phoneNumber;
15
+    }
16
+
17
+
18
+    //add number
19
+    public void addEntry() {
20
+
21
+        return null;
22
+    }
23
+
24
+    //remove number and name
25
+    public void removeContact(String name) {
26
+
27
+    }
28
+
29
+    //Look up entry
30
+    public void listAllNumbers() {
31
+        String[] listAllNumbers = new String[];
32
+        return;
33
+    }
34
+
35
+    //making a list of all entries
36
+    public String getphoneNumbers() {
37
+        return getphoneNumbers();
38
+    }
39
+
40
+}
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
7 58
 }

+ 22
- 1
src/test/java/com/zipcodewilmington/phonebook/PhoneBookTest.java View File

@@ -1,7 +1,28 @@
1 1
 package com.zipcodewilmington.phonebook;
2
-
2
+import org.junit.Test;
3 3
 /**
4 4
  * Created by leon on 1/23/18.
5 5
  */
6 6
 public class PhoneBookTest {
7
+//test for adding an entry
8
+    @Test
9
+    public void test addEntry1() {
10
+        String expected = "856-774-4773";
11
+        PhoneBook.addEntry("Rodney", "856-774-4773");
12
+        String actual = PhoneBook.listAllNumbers("Rodney");
13
+
14
+        TestUtils.assertEquality(expected, actual);
15
+    }
16
+
17
+    @Test
18
+    public void test addEntry2() {
19
+        String expected = "856-774-4773";
20
+        PhoneBook.addEntry("Rodney", "856-774-4773");
21
+        String actual = PhoneBook.listAllNumbers("Rodney");
22
+
23
+        TestUtils.assertEquality(expected, actual);
24
+    }
25
+//
26
+
27
+
7 28
 }