|
|
@@ -6,15 +6,21 @@ import org.junit.Before;
|
|
6
|
6
|
import org.junit.Test;
|
|
7
|
7
|
|
|
8
|
8
|
import static org.junit.Assert.assertEquals;
|
|
|
9
|
+import static org.junit.Assert.assertTrue;
|
|
9
|
10
|
|
|
10
|
11
|
public class PaymentPresenterTest {
|
|
11
|
12
|
|
|
|
13
|
+ Check check;
|
|
|
14
|
+ Paypal paypal;
|
|
|
15
|
+
|
|
|
16
|
+
|
|
|
17
|
+ PaymentPresenter presenter;
|
|
12
|
18
|
|
|
13
|
19
|
@Before
|
|
14
|
20
|
public void setup() {
|
|
15
|
21
|
StringBuilder sb = new StringBuilder();
|
|
16
|
|
- }
|
|
17
|
22
|
|
|
|
23
|
+ }
|
|
18
|
24
|
|
|
19
|
25
|
|
|
20
|
26
|
@Test
|
|
|
@@ -31,8 +37,53 @@ public class PaymentPresenterTest {
|
|
31
|
37
|
|
|
32
|
38
|
@Test
|
|
33
|
39
|
|
|
34
|
|
- public void multiplesToStringById() {
|
|
|
40
|
+ public void toStringByPayerName() {
|
|
|
41
|
+ Payments[] payments = new Payments[2];
|
|
|
42
|
+ Payments paypal = new Paypal(4L, "Tia Mowry", "tia@mowry.com");
|
|
|
43
|
+ Payments check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
44
|
+
|
|
|
45
|
+ payments[0] = paypal;
|
|
|
46
|
+ payments[1] = check;
|
|
|
47
|
+
|
|
|
48
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
49
|
+ String expected = "Check Tia Mowry ***4551\nPaypal Tia Mowry tia@mowry.com\n";
|
|
|
50
|
+
|
|
|
51
|
+ String actual = presenter.toString(payments);
|
|
|
52
|
+ assertEquals(expected, actual);
|
|
|
53
|
+
|
|
35
|
54
|
|
|
36
|
55
|
}
|
|
37
|
56
|
|
|
|
57
|
+ @Test
|
|
|
58
|
+ public void toStringByPayer() {
|
|
|
59
|
+ Payments[] payments = new Payments[2];
|
|
|
60
|
+ Payments paypal = new Paypal(4L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
61
|
+ Payments check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
62
|
+
|
|
|
63
|
+ payments[0] = paypal;
|
|
|
64
|
+ payments[1] = check;
|
|
|
65
|
+
|
|
|
66
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
67
|
+ String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
|
|
|
68
|
+
|
|
|
69
|
+ String actual = presenter.toStringByPayerName(payments);
|
|
|
70
|
+ assertEquals(expected, actual);
|
|
|
71
|
+ }
|
|
|
72
|
+
|
|
|
73
|
+ @Test
|
|
|
74
|
+ public void toStringById(){
|
|
|
75
|
+ Payments[] payments = new Payments[2];
|
|
|
76
|
+ Payments paypal = new Paypal(81L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
77
|
+ Payments check = new Check(120L, "Tia Mowry", "11432543", "134344551");
|
|
|
78
|
+
|
|
|
79
|
+ payments[0] = paypal;
|
|
|
80
|
+ payments[1] = check;
|
|
|
81
|
+
|
|
|
82
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
83
|
+ String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
|
|
|
84
|
+
|
|
|
85
|
+ String actual = presenter.toStringById(payments);
|
|
|
86
|
+ assertEquals(expected, actual);
|
|
|
87
|
+ }
|
|
|
88
|
+
|
|
38
|
89
|
}
|