PaymentPresenterTest.java 1002B

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.zipcoder.payment;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.assertEquals;
  4. public class PaymentPresenterTest {
  5. @Test
  6. public void TestingtoString(){
  7. Payment[] payments = new Payment[0];
  8. PaymentPresenter presenter = new PaymentPresenter();
  9. String expected = "";
  10. String actual = presenter.toString(payments);
  11. assertEquals(expected, actual);
  12. }
  13. @Test
  14. public void multiplepayments() {
  15. Payment[] payments = new Payment[2];
  16. Payment paypal = new PayPal(4L, "Tia Mowry", "tia@mowry.com");
  17. Payment check = new Check(81L, "Tia Mowry", "11432543", "134344551");
  18. payment[0] = paypal;
  19. payment[1] = check;
  20. PaymentPresenter presenter = new PaymentPresenter();
  21. String expected = "Check Tia Mowry ***4551\nPaypal Tia Mowry tia@mowry.com\n";
  22. String actual = presenter.toString(payments);
  23. assertEquals(expected, actual);
  24. }
  25. }