Bläddra i källkod

corrected tests

Tommy Rogers 8 år sedan
förälder
incheckning
480dea91fd

+ 2
- 2
src/test/java/com/zipcoder/payment/CheckTest.java Visa fil

62
 
62
 
63
     @org.junit.Test
63
     @org.junit.Test
64
     public void compareTo(){
64
     public void compareTo(){
65
-        Check check = new Check("Jimmy Dean", "297393022");
66
-        PayPal pp = new PayPal("Slim Shady", "TheRealSlimShady@pleasestandup.com");
65
+        Check check = new Check(889L, "Jimmy Dean", "297393022", "28774821");
66
+        PayPal pp = new PayPal(993L,"Slim Shady", "TheRealSlimShady@pleasestandup.com");
67
 
67
 
68
         assertTrue(check.compareTo(pp) < 0 );
68
         assertTrue(check.compareTo(pp) < 0 );
69
     }
69
     }

+ 2
- 2
src/test/java/com/zipcoder/payment/CreditCardTest.java Visa fil

73
 
73
 
74
     @org.junit.Test
74
     @org.junit.Test
75
     public void compareTo(){
75
     public void compareTo(){
76
-        CreditCard cc = new CreditCard("Jimmy Dean", "1023 2983 0839 2938", 9, 2040);
77
-        PayPal pp = new PayPal("Slim Shady", "TheRealSlimShady@pleasestandup.com");
76
+        CreditCard cc = new CreditCard(889L,"Jimmy Dean", "1023 2983 0839 2938", 9, 2040);
77
+        PayPal pp = new PayPal(993L,"Slim Shady", "TheRealSlimShady@pleasestandup.com");
78
 
78
 
79
         assertTrue(cc.compareTo(pp) < 0 );
79
         assertTrue(cc.compareTo(pp) < 0 );
80
     }
80
     }

+ 2
- 2
src/test/java/com/zipcoder/payment/PayPalTest.java Visa fil

52
 
52
 
53
     @org.junit.Test
53
     @org.junit.Test
54
     public void compareTo(){
54
     public void compareTo(){
55
-        CreditCard cc = new CreditCard("Jimmy Dean", "1023 2983 0839 2938", 9, 2040);
56
-        PayPal pp = new PayPal("Slim Shady", "TheRealSlimShady@pleasestandup.com");
55
+        CreditCard cc = new CreditCard(889L,"Jimmy Dean", "1023 2983 0839 2938", 9, 2040);
56
+        PayPal pp = new PayPal(991L,"Slim Shady", "TheRealSlimShady@pleasestandup.com");
57
 
57
 
58
         assertTrue(cc.compareTo(pp) < 0 );
58
         assertTrue(cc.compareTo(pp) < 0 );
59
     }
59
     }

+ 12
- 5
src/test/java/com/zipcoder/payment/PaymentPresenterTest.java Visa fil

43
     //Create a test case to test the toStringByPayerName method of the PaymentPresenter class
43
     //Create a test case to test the toStringByPayerName method of the PaymentPresenter class
44
     @Test
44
     @Test
45
     public void toStringByPayerName(){
45
     public void toStringByPayerName(){
46
-        Payment[] payment = new Payment[1];
46
+        Payment[] payment = new Payment[2];
47
         Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
47
         Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
48
+        Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
49
+
48
 
50
 
49
         payment[0] = paypal;
51
         payment[0] = paypal;
52
+        payment[1] = check;
50
         PaymentPresenter presenter = new PaymentPresenter();
53
         PaymentPresenter presenter = new PaymentPresenter();
51
 
54
 
52
-        String expected = "Paypal Tamara Mowry tamara@mowry.com";
55
+        String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***2543\n";
53
         String actual = presenter.toStringByPayerName(payment);
56
         String actual = presenter.toStringByPayerName(payment);
54
         assertEquals(expected, actual);
57
         assertEquals(expected, actual);
55
 
58
 
80
 
83
 
81
     @Test
84
     @Test
82
     public void toStringById(){
85
     public void toStringById(){
83
-        Payment[] payment = new Payment[1];
84
-        Payment paypal = new PayPal(120L, "Tamara Mowry", "tamara@mowry.com");
86
+        Payment[] payment = new Payment[2];
87
+        Payment paypal = new PayPal(4L, "Tamara Mowry", "tamara@mowry.com");
88
+        Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
89
+
85
 
90
 
86
         payment[0] = paypal;
91
         payment[0] = paypal;
92
+        payment[1] = check;
93
+
87
         PaymentPresenter presenter = new PaymentPresenter();
94
         PaymentPresenter presenter = new PaymentPresenter();
88
 
95
 
89
-        String expected = "Paypal Tamara Mowry tamara@mowry.com";
96
+        String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***2543\n";
90
         String actual = presenter.toStringById(payment);
97
         String actual = presenter.toStringById(payment);
91
         assertEquals(expected, actual);
98
         assertEquals(expected, actual);
92
 
99