Browse Source

okay, so I started over after having todays lab and I FAILED..YASSS

Katrice Williams-Dredden 6 years ago
parent
commit
ea1ba0041f

+ 27
- 40
src/main/java/com/zipcodewilmington/phonebook/PhoneBook.java View File

2
 
2
 
3
 import java.util.ArrayList;
3
 import java.util.ArrayList;
4
 import java.util.HashMap;
4
 import java.util.HashMap;
5
+import java.util.TreeMap;
5
 
6
 
6
 /**
7
 /**
7
  * Created by leon on 1/23/18.
8
  * Created by leon on 1/23/18.
9
 //the class
10
 //the class
10
 public class PhoneBook {
11
 public class PhoneBook {
11
 
12
 
12
-    private String addName;
13
-    private String addNumber;
14
-    //has to be a person object to go into the array list
15
-    ArrayList<Person> contactList = new ArrayList();
16
-
17
-    public void setAddName(String name){
18
-        this.addName = addName;
19
-
20
-    }
21
-
22
-    public void setAddNumber(String number){
23
-        this.addNumber = addNumber;
13
+    public PhoneBook(){
14
+        TreeMap<String, String>entry = new TreeMap();
24
     }
15
     }
25
 
16
 
26
     public void setLookup(String name){
17
     public void setLookup(String name){
27
-        this.lookup = lookup;
28
-    }
29
 
18
 
30
-    public void setRemove(String name, String number){
31
-        this.name = name;
32
-        this.number = number;
33
     }
19
     }
34
 
20
 
35
-    public void setListNames(String name){
36
-        this.name = name;
37
-    }
21
+    public void setAdd(String name, String number){
38
 
22
 
39
-    public void setListNumber(String number){
40
-        this.number = number;
41
     }
23
     }
42
 
24
 
25
+    public void setRemove(String name){
43
 
26
 
44
-
45
-
46
-
47
-
48
-
49
-    /*public void setAddName(String addName, String addNumber){
50
-        contact.put(addName, addNumber);
51
     }
27
     }
52
 
28
 
53
-    public void setAddNumber(){
54
-
55
-    }*/
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
29
+    public void setDisplay(String name, String number){
64
 
30
 
31
+    }
65
 
32
 
33
+    public void setReverseLookup(String number){
66
 
34
 
35
+    }
67
 
36
 
37
+    public String getNumber(){
38
+        return null;
39
+    }
68
 
40
 
41
+    public String getLookup(){
42
+        return null;
43
+    }
69
 
44
 
45
+    public String getAdd(){
46
+        return null;
47
+    }
70
 
48
 
49
+    public String getRemove(){
50
+        return null;
51
+    }
71
 
52
 
53
+    public String getDisplay(){
54
+        return null;
55
+    }
72
 
56
 
57
+    public String getReverseLookup(){
58
+        return null;
59
+    }
73
 
60
 
74
 
61
 
75
 }
62
 }

+ 15
- 76
src/test/java/com/zipcodewilmington/phonebook/PhoneBookTest.java View File

1
 package com.zipcodewilmington.phonebook;
1
 package com.zipcodewilmington.phonebook;
2
 
2
 
3
+import org.junit.Assert;
3
 import org.junit.Test;
4
 import org.junit.Test;
5
+
6
+import java.util.TreeMap;
7
+
4
 /**
8
 /**
5
  * Created by leon on 1/23/18.
9
  * Created by leon on 1/23/18.
6
  */
10
  */
7
 public class PhoneBookTest {
11
 public class PhoneBookTest {
8
 
12
 
9
     @Test
13
     @Test
10
-    public void testSetAddName() {
11
-        PhoneBook testing = new PhoneBook();
12
-        String expected = "Nathaniel";
13
-
14
-        testing.setAddName(expected);
15
-
16
-        String actual = testing.getAddName();
17
-        Assert.assertEquals(expected, actual);
18
-
19
-
20
-    }
21
-
22
-
23
-    @Test
24
-    public void testSetAddNumber() {
25
-        PhoneBook testing = new PhoneBook();
26
-        String expected = "8567744733";
27
-
28
-        testing.setAddNumber(expected);
29
-
30
-        String actual = testing.getAddNumber();
31
-        Assert.assertEquals(expected, actual);
32
-    }
33
-
34
-    @Test
35
-    public void testSetLookup() {
36
-        PhoneBook testing = new PhoneBook();
37
-        String expected = "Samantha";
38
-
39
-        testing.setLookup(expected);
40
-
41
-        String actual = testing.getLookup();
42
-        Assert.assertEquals(expected, actual);
43
-    }
44
-
45
-    @Test
46
-    public void testSetRemoveName() {
47
-        Phonebook testing = new PhoneBook();
48
-        String expected = "Removal";
49
-
50
-        testing.setRemoveName(expected);
51
-
52
-        String actual = testing.getRemoveName();
53
-        Assert.assertEquals(expected, actual);
54
-    }
55
-
56
-    @Test
57
-    public void testSetRemoveNumber() {
58
-        PhoneBook testing = new PhoneBook();
59
-        String expected = "Remove Number";
60
-
61
-        testing.setRemoveNumber(expected);
62
-
63
-        String actual = testing.getRemoveNumber();
64
-        Assert.assertEquals(expected, actual);
65
-    }
66
-
67
-    @Test
68
-    public void testSetListNames() {
69
-        PhoneBook testing = new PhoneBook();
70
-        String expected = "List of Names";
14
+    public void LookupTest(){
15
+        //Given
16
+        String expectedname = "Katrice";
17
+        String expectednumber = "8567744773";
18
+        //When
19
+        PhoneBook phonebook = new PhoneBook();
20
+        //Then
21
+        //String actualnamephonebook = phonebook.treemap.getKey();
22
+        //String actualnumberphonebook = phonebook.treemap.getKey();
71
 
23
 
72
-        testing.setListNames(expected);
73
 
24
 
74
-        String actual = testing.getListNames();
75
-        Assert.assertEquals(expected, actual);
25
+        String actualnumber = phonebook.getNumber();
26
+        Assert.assertEquals(expectednumber, actualnumber);
76
     }
27
     }
77
 
28
 
78
-    @Test
79
-    public void testSetListNumber() {
80
-        PhoneBook person = new PhoneBook();
81
-        String expected = "List Number";
82
-
83
-        person.setListNumber(expected);
84
-
85
-        String actual = person.getListNumber();
86
-        Assert.assertEquals(expected, actual);
87
-    }
88
-
89
-
90
 
29
 
91
 
30
 
92
     }
31
     }