#23 Nick Satinover - Not Working

Open
nsatinover wants to merge 1 commits from nsatinover/InterfaceComparableLab:master into master

+ 8
- 0
pom.xml View File

@@ -7,6 +7,14 @@
7 7
     <groupId>com.zipcoder</groupId>
8 8
     <artifactId>payment</artifactId>
9 9
     <version>1.0-SNAPSHOT</version>
10
+    <dependencies>
11
+        <dependency>
12
+            <groupId>junit</groupId>
13
+            <artifactId>junit</artifactId>
14
+            <version>RELEASE</version>
15
+            <scope>test</scope>
16
+        </dependency>
17
+    </dependencies>
10 18
     <properties>
11 19
         <maven.compiler.source>1.8</maven.compiler.source>
12 20
         <maven.compiler.target>1.8</maven.compiler.target>

+ 37
- 0
src/main/java/com/zipcoder/payment/CreditCard.java View File

@@ -0,0 +1,37 @@
1
+package com.zipcoder.payment;
2
+
3
+public class CreditCard implements Payment{
4
+
5
+    private long id;
6
+    private String number;
7
+    private int expiredMonth;
8
+    private int expiredYear;
9
+
10
+    @Override
11
+    public long getId() {
12
+        return id;
13
+    }
14
+
15
+    public void setId(long newId){
16
+
17
+        id = newId;
18
+    }
19
+
20
+    @Override
21
+    public String getPayerName() {
22
+        return null;
23
+    }
24
+
25
+    @Override
26
+    public String getShortDescription() {
27
+        return null;
28
+    }
29
+
30
+
31
+
32
+    public void setNumber(String s) {
33
+        number = s;
34
+    }
35
+
36
+
37
+}

+ 7
- 0
src/main/java/com/zipcoder/payment/Payment.java View File

@@ -0,0 +1,7 @@
1
+package com.zipcoder.payment;
2
+
3
+public interface Payment {
4
+    public long getId();
5
+    public String getPayerName();
6
+    public String getShortDescription();
7
+}

+ 1
- 0
src/main/java/com/zipcoder/payment/PaymentPresenter.java View File

@@ -3,4 +3,5 @@ package com.zipcoder.payment;
3 3
 public class PaymentPresenter {
4 4
 
5 5
 
6
+
6 7
 }

+ 40
- 0
src/test/java/com/zipcoder/payment/CreditCardTest.java View File

@@ -0,0 +1,40 @@
1
+package com.zipcoder.payment;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class CreditCardTest {
7
+    CreditCard creditCard = new CreditCard();
8
+
9
+    @Test
10
+    public void getIdTest(){
11
+        creditCard.setId(1);
12
+        long expected = 1;
13
+        long actual = creditCard.getId();
14
+        Assert.assertEquals(expected, actual);
15
+    }
16
+
17
+    @Test
18
+    public void getPayerNameTest(){
19
+        String expected = "Test";
20
+        String actual = creditCard.getPayerName();
21
+        Assert.assertEquals(expected, actual);
22
+    }
23
+
24
+    @Test
25
+    public void getShortDescriptionTest(){
26
+        String expected = "Test";
27
+        String actual = creditCard.getShortDescription();
28
+        Assert.assertEquals(expected, actual);
29
+    }
30
+
31
+    @Test
32
+    public void getNumberTest(){
33
+        creditCard.setNumber("1234")
34
+        String expected = "1234";
35
+        String actual = creditCard.getNumber();
36
+        Assert.assertEquals(expected, actual);
37
+    }
38
+
39
+
40
+}