| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.zipcoder.payment;
-
- import org.junit.jupiter.api.Test;
-
- import static org.junit.jupiter.api.Assertions.assertEquals;
-
- public class PaymentPresenterTest {
-
-
- @Test
- public void toStringTest() {
- Payment[] payments = new Payment[0];
- PaymentPresenter pp = new PaymentPresenter();
- String expected = "";
-
- String actual = pp.toString(payments);
-
- assertEquals(expected, actual);
-
-
- }
-
-
- @Test
- public void toStringMultipleTest() {
- Payment[] payments = new Payment[2];
- Payment paypal = new Paypal("Tia Mowry", "tia@mowry.com");
- Payment check = new Check("Lewis Dominguez", "11432543", "134344551");
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Check Lewis Dominguez ***4551\nPaypal Tia Mowry tia@mowry.com\n";
-
- String actual = presenter.toString(payments);
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringPaymentByPayer() {
- Payment[] payments = new Payment[2];
- Payment paypal = new Paypal("Tia Mowry", "tia@mowry.com");
- Payment check = new Check("Lewis Dominguez", "11432543", "134344551");
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Check Lewis Dominguez ***4551\nPaypal Tia Mowry tia@mowry.com\n";
-
- String actual = presenter.toStringByPayerName(payments);
- assertEquals(expected, actual);
- }
-
- @Test
- public void toStringBySetIdTest() {
- Payment[] payments = new Payment[2];
- Paypal paypal = new Paypal("Tia Mowry", "tia@mowry.com");
- Check check = new Check("Lewis Dominguez", "11432543", "134344551");
- paypal.setId(2L);
- check.setId(1L);
-
- payments[0] = paypal;
- payments[1] = check;
-
- PaymentPresenter presenter = new PaymentPresenter();
- String expected = "Check Lewis Dominguez ***4551\nPaypal Tia Mowry tia@mowry.com\n";
-
- String actual = presenter.toStringBySetId(payments);
- assertEquals(expected, actual);
-
- }
-
-
-
- }
-
|