|
|
@@ -43,13 +43,16 @@ public class PaymentPresenterTest {
|
|
43
|
43
|
//Create a test case to test the toStringByPayerName method of the PaymentPresenter class
|
|
44
|
44
|
@Test
|
|
45
|
45
|
public void toStringByPayerName(){
|
|
46
|
|
- Payment[] payment = new Payment[1];
|
|
|
46
|
+ Payment[] payment = new Payment[2];
|
|
47
|
47
|
Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
48
|
+ Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
49
|
+
|
|
48
|
50
|
|
|
49
|
51
|
payment[0] = paypal;
|
|
|
52
|
+ payment[1] = check;
|
|
50
|
53
|
PaymentPresenter presenter = new PaymentPresenter();
|
|
51
|
54
|
|
|
52
|
|
- String expected = "Paypal Tamara Mowry tamara@mowry.com";
|
|
|
55
|
+ String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***2543\n";
|
|
53
|
56
|
String actual = presenter.toStringByPayerName(payment);
|
|
54
|
57
|
assertEquals(expected, actual);
|
|
55
|
58
|
|
|
|
@@ -80,13 +83,17 @@ public class PaymentPresenterTest {
|
|
80
|
83
|
|
|
81
|
84
|
@Test
|
|
82
|
85
|
public void toStringById(){
|
|
83
|
|
- Payment[] payment = new Payment[1];
|
|
84
|
|
- Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
86
|
+ Payment[] payment = new Payment[2];
|
|
|
87
|
+ Payment paypal = new PayPal(4L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
88
|
+ Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
89
|
+
|
|
85
|
90
|
|
|
86
|
91
|
payment[0] = paypal;
|
|
|
92
|
+ payment[1] = check;
|
|
|
93
|
+
|
|
87
|
94
|
PaymentPresenter presenter = new PaymentPresenter();
|
|
88
|
95
|
|
|
89
|
|
- String expected = "Paypal Tamara Mowry tamara@mowry.com";
|
|
|
96
|
+ String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***2543\n";
|
|
90
|
97
|
String actual = presenter.toStringById(payment);
|
|
91
|
98
|
assertEquals(expected, actual);
|
|
92
|
99
|
|