|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+package com.zipcoder.payment;
|
|
|
2
|
+
|
|
|
3
|
+import org.junit.jupiter.api.Test;
|
|
|
4
|
+
|
|
|
5
|
+import static org.junit.jupiter.api.Assertions.*;
|
|
|
6
|
+
|
|
|
7
|
+class PaymentSortByPayerTest {
|
|
|
8
|
+
|
|
|
9
|
+ @Test
|
|
|
10
|
+ void compairTest1() {
|
|
|
11
|
+ //When
|
|
|
12
|
+ PaymentSortByPayer ps = new PaymentSortByPayer();
|
|
|
13
|
+ Payment cc = new CreditCard(12, 4111131,"Jimmy Maidanos", 4, 11);
|
|
|
14
|
+ Payment pp = new Paypal(23, "Nicholas Maidanos", "nmaidanos@gmail.com");
|
|
|
15
|
+
|
|
|
16
|
+ //Expect
|
|
|
17
|
+ int expect = -1;
|
|
|
18
|
+
|
|
|
19
|
+ //Actual
|
|
|
20
|
+ int actual = ps.compare(cc, pp);
|
|
|
21
|
+
|
|
|
22
|
+ assertEquals(expect, actual);
|
|
|
23
|
+ }
|
|
|
24
|
+
|
|
|
25
|
+ @Test
|
|
|
26
|
+ void compairTest2() {
|
|
|
27
|
+ //When
|
|
|
28
|
+ PaymentSortByPayer ps = new PaymentSortByPayer();
|
|
|
29
|
+ Payment cc = new CreditCard(12, 4111131,"Zimmy Maidanos", 4, 11);
|
|
|
30
|
+ Payment pp = new Paypal(23, "Nicholas Maidanos", "nmaidanos@gmail.com");
|
|
|
31
|
+
|
|
|
32
|
+ //Expect
|
|
|
33
|
+ int expect = 1;
|
|
|
34
|
+
|
|
|
35
|
+ //Actual
|
|
|
36
|
+ int actual = ps.compare(cc, pp);
|
|
|
37
|
+
|
|
|
38
|
+ assertEquals(expect, actual);
|
|
|
39
|
+ }
|
|
|
40
|
+
|
|
|
41
|
+ @Test
|
|
|
42
|
+ void compairTest3() {
|
|
|
43
|
+ //When
|
|
|
44
|
+ PaymentSortByPayer ps = new PaymentSortByPayer();
|
|
|
45
|
+ Payment cc = new CreditCard(12, 4111131,"Nicholas Maidanos", 4, 11);
|
|
|
46
|
+ Payment pp = new Paypal(23, "Nicholas Maidanos", "nmaidanos@gmail.com");
|
|
|
47
|
+
|
|
|
48
|
+ //Expect
|
|
|
49
|
+ int expect = 0;
|
|
|
50
|
+
|
|
|
51
|
+ //Actual
|
|
|
52
|
+ int actual = ps.compare(cc, pp);
|
|
|
53
|
+
|
|
|
54
|
+ assertEquals(expect, actual);
|
|
|
55
|
+ }
|
|
|
56
|
+}
|