shakila 8 лет назад
Родитель
Сommit
6dd9f57e86

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

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

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

@@ -1,7 +1,5 @@
1 1
 package com.zipcoder.payment;
2
-
3 2
 import org.junit.Test;
4
-
5 3
 import static org.junit.Assert.*;
6 4
 
7 5
 public class PayPalTest {

+ 64
- 1
src/test/java/com/zipcoder/payment/PaymentPresenterTest.java Просмотреть файл

@@ -1,4 +1,67 @@
1 1
 package com.zipcoder.payment;
2 2
 
3
-public class PaymentPresenterTest {
3
+import org.junit.Test;
4
+import static org.junit.Assert.*;
5
+
6
+
7
+public class PaymentPresenterTest1 {
8
+
9
+    @Test
10
+    public void toString1() {
11
+        Payment[] payments = new payment.Payment[0];
12
+        PaymentPresenter presenter = new PaymentPresenter();
13
+        String expected = "";
14
+
15
+        String actual = presenter.toString(payments);
16
+
17
+        assertEquals(expected, actual);
18
+    }
19
+
20
+    @Test
21
+    public void toString2(){
22
+        Payment[] payments = new com.zipcoder.payment.Payment[2];
23
+        Payment payPal = new PayPayl(4L, "Tia Mowry", "tia@mowry.com");
24
+        Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551")
25
+
26
+        payment[0] = payPal;
27
+        payment[1] = check;
28
+
29
+        PaymentPresenter presenter = new PaymentPresenter();
30
+        String expected = "Check Tia Mowry ***4551\nPaypal Tia Mowry tia@mowry.com\n";
31
+
32
+        String actual = presenter.toString(payments);
33
+        assertEquals(expected, actual);
34
+    }
35
+
36
+    @Test
37
+    public void toStringByPayerName() {
38
+        Payment[] payments = new com.zipcoder.payment.Payment[2];
39
+        Payment paypal = new PayPayl(4L, "Tamara Mowry", "tamara@mowry.com");
40
+        Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551")
41
+
42
+        payment[0] = paypal;
43
+        payment[1] = check;
44
+
45
+        PaymentPresenter presenter = new PaymentPresenter();
46
+        String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
47
+
48
+        String actual = presenter.toStringByPayerName(payments);
49
+        assertEquals(expected, actual);
50
+    }
51
+
52
+    @Test
53
+    public void toStringById(){
54
+        Payment[] payments = new com.zipcoder.payment.Payment[2];
55
+        Payment paypal = new PayPayl(120L, "Tamara Mowry", "tamara@mowry.com");
56
+        Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551")
57
+
58
+        payment[0] = paypal;
59
+        payment[1] = check;
60
+
61
+        PaymentPresenter presenter = new PaymentPresenter();
62
+        String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
63
+
64
+        String actual = presenter.toStringById(payments);
65
+        assertEquals(expected, actual);
66
+    }
4 67
 }