| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package com.zipcoder.payment;
-
- import org.junit.Test;
- import static org.junit.Assert.*;
-
- public class PaymentPresenterTest {
-
- @Test
- public void toStringTest(){
- Payment[] payments = new Payment[0];
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "";
-
- String actual = presenter.toString(payments);
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringMultiplePaymentsTest(){
- Payment[] payments = new Payment[2];
- Payment paypal = new Paypal(4L, "Tia Mowry", "tia@mowry.com");
- Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Check Tia Mowry ***4551\nPaypal Tia Mowry tia@mowry.com\n";
-
- String actual = presenter.toString(payments);
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringByPayerNameTest(){
- Payment[] payments = new Payment[2];
- Payment paypal = new Paypal(4L, "Tamara Mowry", "tamara@mowry.com");
- Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
-
- String actual = presenter.toStringByPayerName(payments);
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringById(){
- Payment[] payments = new Payment[2];
- Payment paypal = new Paypal(81L, "Tamara Mowry", "tamara@mowry.com");
- Payment check = new Check(120L, "Tia Mowry", "11432543", "134344551");
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Paypal Tamara Mowry tamara@mowry.com\nCheck Tia Mowry ***4551\n";
-
- String actual = presenter.toStringById(payments);
- assertEquals(expected, actual);
- }
-
- }
|