Browse Source

better form

Chad 8 years ago
parent
commit
8c4b8b4cca

+ 2
- 1
src/main/java/com/zipcoder/payment/PaymentPresenter.java View File

22
 }
22
 }
23
 
23
 
24
     public String toStringByPayerName(Payment[] payments){
24
     public String toStringByPayerName(Payment[] payments){
25
+
25
         StringBuilder output = new StringBuilder();
26
         StringBuilder output = new StringBuilder();
26
         Arrays.sort(payments,new PaymentSortByPayer());
27
         Arrays.sort(payments,new PaymentSortByPayer());
27
         for (int i=0; i<payments.length; i++) {
28
         for (int i=0; i<payments.length; i++) {
33
 
34
 
34
     public String toStringById(Payment[] payments){
35
     public String toStringById(Payment[] payments){
35
         StringBuilder output = new StringBuilder();
36
         StringBuilder output = new StringBuilder();
36
-        Arrays.sort(payments,(p, q) -> p.getId().compareTo(q.getId()));
37
+        Arrays.sort(payments, Comparator.comparing(Payment::getId));
37
 
38
 
38
         for (int i=0; i<payments.length; i++) {
39
         for (int i=0; i<payments.length; i++) {
39
             output.append(payments[i].getShortDescription()+"\n");
40
             output.append(payments[i].getShortDescription()+"\n");

+ 2
- 0
src/main/java/com/zipcoder/payment/Paypal.java View File

12
 
12
 
13
     }
13
     }
14
 
14
 
15
+    public Paypal(){}
16
+
15
     public void setId(Long id) {
17
     public void setId(Long id) {
16
         this.id = id;
18
         this.id = id;
17
     }
19
     }

+ 4
- 1
src/test/java/com/zipcoder/payment/PaymentPresenterTest.java View File

67
     String actual = presenter.toStringById(payments);
67
     String actual = presenter.toStringById(payments);
68
 
68
 
69
     Assert.assertEquals(expected, actual);
69
     Assert.assertEquals(expected, actual);
70
-}
70
+
71
+    }
72
+
73
+
71
 }
74
 }