Khalil Malik Saboor пре 8 година
родитељ
комит
93333fe901

+ 13
- 1
src/main/java/com/zipcoder/payment/PaymentPresenter.java Прегледај датотеку

@@ -1,8 +1,20 @@
1 1
 package com.zipcoder.payment;
2 2
 
3
+import java.util.Arrays;
4
+
3 5
 public class PaymentPresenter {
4 6
 
5 7
     public String toString(Payment[] payments) {
6
-        return null;
8
+        Arrays.sort(payments);
9
+        StringBuilder sb = new StringBuilder();
10
+        for (Payment o: payments) {
11
+            o.getID();
12
+            o.getPayerName();
13
+
14
+            sb.append(o.getShortDescription()+"\n");
15
+        }
16
+        return sb.toString();
7 17
     }
18
+
19
+
8 20
 }

+ 2
- 2
src/test/java/com/zipcoder/payment/PaymentPresenterTest.java Прегледај датотеку

@@ -21,8 +21,8 @@ public class PaymentPresenterTest {
21 21
         Payment Paypal = new Paypal(4L, "Tia Mowry", "tia@mowry.com");
22 22
         Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
23 23
 
24
-        payment[0] = Paypal;
25
-        payment[1] = check;
24
+        payments[0] = Paypal;
25
+        payments[1] = check;
26 26
 
27 27
         PaymentPresenter presenter = new PaymentPresenter();
28 28
         String expected = "Check Tia Mowry ***4551\nPaypal Tia Mowry tia@mowry.com\n";