Mexi 8 лет назад
Родитель
Сommit
59c0a82d97

+ 8
- 0
pom.xml Просмотреть файл

@@ -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
 
11 19
 
12 20
 </project>

+ 46
- 0
src/main/java/com/zipcoder/payment/Check.java Просмотреть файл

@@ -0,0 +1,46 @@
1
+package com.zipcoder.payment;
2
+
3
+public class Check implements Payment {
4
+    long id;
5
+    String payerName;
6
+
7
+    public Long getId() {
8
+        return null;
9
+    }
10
+
11
+    public void setId(long id){
12
+        this.id = id;
13
+    }
14
+
15
+    public String getPayerName() {
16
+        return null;
17
+    }
18
+
19
+    public void setPayerName(String payerName) {
20
+        this.payerName = payerName;
21
+    }
22
+
23
+
24
+    public String getRountingNumber(){
25
+
26
+    }
27
+
28
+    public String setRountingNumber(){
29
+
30
+
31
+    }
32
+
33
+    public String getAccountNumber(){
34
+
35
+
36
+    }
37
+
38
+    public String setAccountNumber(){
39
+
40
+        
41
+    }
42
+
43
+    public String getShortDescription() {
44
+        return null;
45
+    }
46
+}

+ 52
- 0
src/main/java/com/zipcoder/payment/CreditCard.java Просмотреть файл

@@ -0,0 +1,52 @@
1
+package com.zipcoder.payment;
2
+
3
+public class CreditCard implements Payment {
4
+    private long id;
5
+    private String payerName;
6
+    private String number;
7
+    private int expiredMonth;
8
+    private int expiredYear;
9
+
10
+
11
+    public Long getId() {
12
+        return this.id;
13
+    }
14
+
15
+    public void setId(long id){
16
+        this.id = id;
17
+
18
+    }
19
+
20
+    public String getPayerName() {
21
+        return this.payerName;
22
+    }
23
+
24
+    public void setPayerName(String payerName){
25
+        this.payerName = payerName;
26
+    }
27
+    public String getShortDescription() {
28
+
29
+
30
+        return "CC " + getPayerName() + " " + getNumber() + " " + getExpiredMonth() + "/" + getExpiredYear();
31
+    }
32
+    public String getNumber(){
33
+        return this.number;
34
+    }
35
+    public void setNumber(String number){
36
+        this.number = number;
37
+
38
+    }
39
+    public int getExpiredMonth(){
40
+        return this.expiredMonth;
41
+    }
42
+    public void setExpiredMonth(int expiredMonth){
43
+     this.expiredMonth = expiredMonth;
44
+    }
45
+    public int getExpiredYear(){
46
+     return this.expiredYear;
47
+    }
48
+
49
+    public void setExpiredYear(int expiredYear){
50
+        this.expiredYear = expiredYear;
51
+    }
52
+}

+ 10
- 0
src/main/java/com/zipcoder/payment/Payment.java Просмотреть файл

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

+ 4
- 0
src/test/java/com/zipcoder/payment/CheckTest.java Просмотреть файл

@@ -0,0 +1,4 @@
1
+package com.zipcoder.payment;
2
+
3
+public class CheckTest {
4
+}

+ 70
- 0
src/test/java/com/zipcoder/payment/CreditCardTest.java Просмотреть файл

@@ -0,0 +1,70 @@
1
+package com.zipcoder.payment;
2
+import org.junit.Assert;
3
+import org.junit.Test;
4
+public class CreditCardTest {
5
+
6
+    @Test
7
+    public void testGetId() {
8
+    CreditCard creditCard = new CreditCard();
9
+    long expected = 12312;
10
+    creditCard.setId(12312);
11
+    long actual = creditCard.getId();
12
+    Assert.assertEquals(expected,actual);
13
+    }
14
+
15
+    @Test
16
+    public void testSetId(){
17
+    CreditCard creditCard = new CreditCard();
18
+    creditCard.setId(12345);
19
+    long expected = 12345;
20
+    long actual = creditCard.getId();
21
+    Assert.assertEquals(expected,actual);
22
+//    Assert.assertTrue(creditCard.getId()==12345);
23
+    }
24
+
25
+    @Test
26
+    public void testGetPayerName() {
27
+    }
28
+
29
+    @Test
30
+    public void testGetShortDescription() {
31
+    }
32
+
33
+
34
+
35
+    @Test
36
+    public void getPayerName() {
37
+    }
38
+
39
+    @Test
40
+    public void setPayerName() {
41
+    }
42
+
43
+    @Test
44
+    public void getShortDescription1() {
45
+    }
46
+
47
+    @Test
48
+    public void getNumber() {
49
+    }
50
+
51
+    @Test
52
+    public void setNumber() {
53
+    }
54
+
55
+    @Test
56
+    public void getExpiredMonth() {
57
+    }
58
+
59
+    @Test
60
+    public void setExpiredMonth() {
61
+    }
62
+
63
+    @Test
64
+    public void getExpiredYear() {
65
+    }
66
+
67
+    @Test
68
+    public void setExpiredYear() {
69
+    }
70
+}