浏览代码

Got a good idea but nothin concrete

Kthomas 6 年前
父节点
当前提交
c24023085c

+ 19
- 0
pom.xml 查看文件

@@ -7,6 +7,25 @@
7 7
     <groupId>com.zipcodewilmington</groupId>
8 8
     <artifactId>phonebok</artifactId>
9 9
     <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>1.7</source>
17
+                    <target>1.7</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
22
+    <dependencies>
23
+        <dependency>
24
+            <groupId>org.junit.jupiter</groupId>
25
+            <artifactId>junit-jupiter-api</artifactId>
26
+            <version>RELEASE</version>
27
+        </dependency>
28
+    </dependencies>
10 29
 
11 30
 
12 31
 </project>

+ 33
- 4
src/main/java/com/zipcodewilmington/phonebook/PhoneBook.java 查看文件

@@ -1,7 +1,36 @@
1 1
 package com.zipcodewilmington.phonebook;
2
+import org.junit.Assert;
3
+import org.junit.Test;
4
+import org.junit.jupiter.api.Test;
5
+import sun.jvm.hotspot.utilities.Assert;
2 6
 
3
-/**
4
- * Created by leon on 1/23/18.
5
- */
6
-public class PhoneBook {
7
+//added all useful utilities
8
+Private class Person {
9
+    private String name;
10
+    private String phNumber;
11
+//initialize strings
12
+    public Person (String name, String phNumber) {
13
+        this.name = name;
14
+        this.phNumber = phNumber;
15
+    }
16
+//get entry (name and number)
17
+    public void removeEntry(String name) {
18
+
19
+    }
20
+//remove entry from list
21
+    public String[] getEntry() {
22
+        return getEntry();
23
+    }
24
+//Look up person
25
+    public void listAll(){
26
+        String[] listAll = new String[];
27
+        return;
28
+    }
29
+//List all names in registry
30
+    public String getPhNumber() {
31
+        return getPhNumber+= listAll();
32
+    }
33
+//List all entries
7 34
 }
35
+
36
+//this is just a skeleton, gonna work on syntax

+ 37
- 0
src/test/java/com/zipcodewilmington/phonebook/PersonTest.java 查看文件

@@ -0,0 +1,37 @@
1
+package com.zipcodewilmington.phonebook;
2
+
3
+
4
+import org.junit.jupiter.api.Test;
5
+import sun.jvm.hotspot.utilities.Assert;
6
+
7
+
8
+class PersonTest {
9
+//need to generate test to add an entry to phbook
10
+        PhBook = new PhBook(addEntry);
11
+        name = new Person("name", "number");}
12
+
13
+    }
14
+
15
+    @Test
16
+    void removeEntry1() {
17
+            Person.add("name", "number");
18
+            Person.remove("name");
19
+            Assert.assertFalse(Person.entryCheck("name"));
20
+}
21
+
22
+    @Test
23
+    void getEntry() {
24
+            Person.add("name", "number");
25
+            Assert.assertEquals("name".getPhNumber(), Person.get("name"));
26
+}
27
+
28
+    @Test
29
+    void listAll() {
30
+//need to set parameters for test
31
+}
32
+
33
+    @Test
34
+    void getPhNumber1() {
35
+//not sure of the syntax how to set keys and values in array list and return
36
+}
37
+}

+ 0
- 7
src/test/java/com/zipcodewilmington/phonebook/PhoneBookTest.java 查看文件

@@ -1,7 +0,0 @@
1
-package com.zipcodewilmington.phonebook;
2
-
3
-/**
4
- * Created by leon on 1/23/18.
5
- */
6
-public class PhoneBookTest {
7
-}