|
@@ -83,6 +83,7 @@ Note: You may use the String/Long compareTo methods in your code
|
83
|
83
|
1. Create a `PaymentPresenterTest`
|
84
|
84
|
2. Create a test case to test the `toString` method of the PaymentPresenter class
|
85
|
85
|
- When there is no payment
|
|
86
|
+
|
86
|
87
|
```
|
87
|
88
|
Payment[] payments = new Payment[0];
|
88
|
89
|
PaymentPresenter presenter = new PaymentPresenter();
|
|
@@ -92,7 +93,9 @@ Note: You may use the String/Long compareTo methods in your code
|
92
|
93
|
|
93
|
94
|
assertEquals(expected, actual);
|
94
|
95
|
```
|
|
96
|
+
|
95
|
97
|
- When there are multiple payments, you need to sort it first, then build the string using the short description
|
|
98
|
+
|
96
|
99
|
```
|
97
|
100
|
Payment[] payments = new Payment[2];
|
98
|
101
|
Payment paypal = new PayPayl(4L, "Tia Mowry", "tia@mowry.com");
|
|
@@ -106,8 +109,10 @@ Note: You may use the String/Long compareTo methods in your code
|
106
|
109
|
String actual = presenter.toString(payments);
|
107
|
110
|
assertEquals(expected, actual);
|
108
|
111
|
```
|
|
112
|
+
|
109
|
113
|
3. Create a test case to test the `toStringByPayerName` method of the PaymentPresenter class
|
110
|
114
|
- When there are multiple payments, you need to sort by calling the `PaymentSortByPayer` class to sort, then build the string using the short description
|
|
115
|
+
|
111
|
116
|
```
|
112
|
117
|
Payment[] payments = new Payment[2];
|
113
|
118
|
Payment paypal = new PayPayl(4L, "Tamara Mowry", "tamara@mowry.com");
|
|
@@ -121,8 +126,10 @@ Note: You may use the String/Long compareTo methods in your code
|
121
|
126
|
String actual = presenter.toString(payments);
|
122
|
127
|
assertEquals(expected, actual);
|
123
|
128
|
```
|
|
129
|
+
|
124
|
130
|
4. Create a test case to test the `toStringById` method of the PaymentPresenter class
|
125
|
131
|
- When there are multiple payments, you need to sort by creating a lambda to sort the payment by id, then build the string using the short description
|
|
132
|
+
|
126
|
133
|
```
|
127
|
134
|
Payment[] payments = new Payment[2];
|
128
|
135
|
Payment paypal = new PayPayl(120L, "Tamara Mowry", "tamara@mowry.com");
|