|
|
@@ -1,4 +1,35 @@
|
|
1
|
1
|
package com.zipcoder.payment;
|
|
2
|
2
|
|
|
|
3
|
+import org.junit.Assert;
|
|
|
4
|
+import org.junit.Test;
|
|
|
5
|
+
|
|
3
|
6
|
public class PaymentPresenterTest {
|
|
|
7
|
+
|
|
|
8
|
+ @Test
|
|
|
9
|
+ public void toStringNoPaymentTest(){
|
|
|
10
|
+ Payment[] payments = new Payment[0];
|
|
|
11
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
12
|
+ String expected = "";
|
|
|
13
|
+
|
|
|
14
|
+ String actual = presenter.toString(payments);
|
|
|
15
|
+
|
|
|
16
|
+ Assert.assertEquals(expected, actual);
|
|
|
17
|
+ }
|
|
|
18
|
+
|
|
|
19
|
+ @Test
|
|
|
20
|
+ public void toStringHasPaymentTest() {
|
|
|
21
|
+ Payment[] payments = new Payment[2];
|
|
|
22
|
+ Payment paypal = new PayPal(4L, "Tia Mowry", "tia@mowry.com");
|
|
|
23
|
+ Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
|
|
|
24
|
+
|
|
|
25
|
+ payments[0] = paypal;
|
|
|
26
|
+ payments[1] = check;
|
|
|
27
|
+
|
|
|
28
|
+ PaymentPresenter presenter = new PaymentPresenter();
|
|
|
29
|
+ String expected = "Check Tia Mowry ***4551\nPayPal Tia Mowry tia@mowry.com\n";
|
|
|
30
|
+
|
|
|
31
|
+ String actual = presenter.toString(payments);
|
|
|
32
|
+ Assert.assertEquals(expected, actual);
|
|
|
33
|
+
|
|
|
34
|
+ }
|
|
4
|
35
|
}
|