|
@@ -61,7 +61,7 @@
|
61
|
61
|
# Section 2 - Comparable
|
62
|
62
|
Note: You may use the String/Long compareTo methods in your code
|
63
|
63
|
1. Edit the `Payment` class to extends the Comparable interface
|
64
|
|
- - `public class Payment extends Comparable<Payment>`
|
|
64
|
+ - `public interface Payment extends Comparable<Payment>`
|
65
|
65
|
- This indicate that payment can be comparable, which means it can be sorted
|
66
|
66
|
2. Fix the syntax error in your CreditCard, Check, and Paypal class by adding the compare method
|
67
|
67
|
3. Create a test for the `compareTo` method. Compare using the getShortDescription()
|
|
@@ -123,7 +123,7 @@ Note: You may use the String/Long compareTo methods in your code
|
123
|
123
|
PaymentPresenter presenter = new PaymentPresenter();
|
124
|
124
|
String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
|
125
|
125
|
|
126
|
|
- String actual = presenter.toString(payments);
|
|
126
|
+ String actual = presenter.toStringByPayerName(payments);
|
127
|
127
|
assertEquals(expected, actual);
|
128
|
128
|
```
|
129
|
129
|
|
|
@@ -140,6 +140,6 @@ Note: You may use the String/Long compareTo methods in your code
|
140
|
140
|
PaymentPresenter presenter = new PaymentPresenter();
|
141
|
141
|
String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
|
142
|
142
|
|
143
|
|
- String actual = presenter.toString(payments);
|
|
143
|
+ String actual = presenter.toStringById(payments);
|
144
|
144
|
assertEquals(expected, actual);
|
145
|
145
|
```
|