| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package com.zipcoder.payment;
-
-
- import org.junit.Test;
-
- import static org.junit.Assert.assertEquals;
-
- public class PaymentPresenterTest {
-
-
- @Test
-
- public void toStringWhenNoPaymentTest() {
-
- Payment[] payments = new Payment[0];
- PaymentPresenter presenter = new PaymentPresenter();
-
- String expected = "";
- String actual = presenter.toString(payments);
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringWhenMultiplePaymentTest() {
- 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 toStringByIdTest() {
- 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);
- }
- }
|