|
|
@@ -32,4 +32,41 @@ public class PaymentPresenterTest {
|
|
32
|
32
|
Assert.assertEquals(expected, actual);
|
|
33
|
33
|
|
|
34
|
34
|
}
|
|
|
35
|
+
|
|
|
36
|
+ @Test
|
|
|
37
|
+ public void toStringByPayerName(){
|
|
|
38
|
+
|
|
|
39
|
+ Payment[] payments = new Payment[2];
|
|
|
40
|
+ Payment paypal = new PayPal(4L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
41
|
+ Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
42
|
+
|
|
|
43
|
+ payments[0] = paypal;
|
|
|
44
|
+ payments[1] = check;
|
|
|
45
|
+
|
|
|
46
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
47
|
+ String expected = "PayPal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
|
|
|
48
|
+
|
|
|
49
|
+ String actual = presenter.toStringByPayerName(payments);
|
|
|
50
|
+ Assert.assertEquals(expected, actual);
|
|
|
51
|
+
|
|
|
52
|
+ }
|
|
|
53
|
+
|
|
|
54
|
+ @Test
|
|
|
55
|
+ public void toStringById(){
|
|
|
56
|
+
|
|
|
57
|
+ Payment[] payments = new Payment[2];
|
|
|
58
|
+ Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
|
|
|
59
|
+ Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
60
|
+
|
|
|
61
|
+ payments[0] = paypal;
|
|
|
62
|
+ payments[1] = check;
|
|
|
63
|
+
|
|
|
64
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
65
|
+ String expected = "Check Tia Mowry ***4551\nPayPal Tamara Mowry tamara@mowry.com\n";
|
|
|
66
|
+
|
|
|
67
|
+ String actual = presenter.toString(payments);
|
|
|
68
|
+ Assert.assertEquals(expected, actual);
|
|
|
69
|
+
|
|
|
70
|
+
|
|
|
71
|
+ }
|
|
35
|
72
|
}
|