|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+package com.zipcoder.payment;
|
|
|
2
|
+
|
|
|
3
|
+import org.junit.Assert;
|
|
|
4
|
+import org.junit.Before;
|
|
|
5
|
+import org.junit.Test;
|
|
|
6
|
+
|
|
|
7
|
+public class PaymentSortByPayerTest {
|
|
|
8
|
+ private PaymentSortByPayer test;
|
|
|
9
|
+
|
|
|
10
|
+ @Before
|
|
|
11
|
+ public void initialize() {
|
|
|
12
|
+ test = new PaymentSortByPayer();
|
|
|
13
|
+ }
|
|
|
14
|
+
|
|
|
15
|
+ @Test
|
|
|
16
|
+ public void compareTest01() {
|
|
|
17
|
+ Check payment1 = new Check(100,"Aaron Aaronson", "1234567", "764321");
|
|
|
18
|
+ CreditCard payment2 = new CreditCard(200, "Zach Zachariah", "455555", 5, 2022);
|
|
|
19
|
+
|
|
|
20
|
+ int actual = test.compare(payment1, payment2);
|
|
|
21
|
+
|
|
|
22
|
+ Assert.assertTrue(actual > 0);
|
|
|
23
|
+ }
|
|
|
24
|
+
|
|
|
25
|
+ @Test
|
|
|
26
|
+ public void compareTest02() {
|
|
|
27
|
+ Check payment1 = new Check(300,"Zaron Aaronson", "1234567", "764321");
|
|
|
28
|
+ PayPal payment2 = new PayPal(15,"Momo Hashimoto", "kawaii54@line.com");
|
|
|
29
|
+
|
|
|
30
|
+ int actual = test.compare(payment1, payment2);
|
|
|
31
|
+
|
|
|
32
|
+ Assert.assertTrue(actual < 0);
|
|
|
33
|
+ }
|
|
|
34
|
+
|
|
|
35
|
+ @Test
|
|
|
36
|
+ public void compareTest03() {
|
|
|
37
|
+ Check payment1 = new Check(300,"Zaron Aaronson", "1234567", "764321");
|
|
|
38
|
+ Check payment2 = new Check(300,"Zaron Aaronson", "1234567", "764321");
|
|
|
39
|
+
|
|
|
40
|
+ int actual = test.compare(payment1, payment2);
|
|
|
41
|
+
|
|
|
42
|
+ Assert.assertTrue(actual == 0);
|
|
|
43
|
+ }
|
|
|
44
|
+}
|