PayPalTest.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.zipcoder.payment;
  2. import org.junit.Assert;
  3. import org.junit.Test;
  4. public class PayPalTest {
  5. @Test
  6. public void idGetterSetterTest(){
  7. PayPal payPal = new PayPal();
  8. payPal.setId(12345L);
  9. Long expected = 12345L;
  10. Assert.assertEquals(expected, payPal.getID());
  11. }
  12. @Test
  13. public void payerNameGetterSetterTest(){
  14. PayPal payPal = new PayPal();
  15. payPal.setPayerName("John Jacob");
  16. String expected = "John Jacob";
  17. Assert.assertEquals(expected, payPal.getPayerName());
  18. }
  19. @Test
  20. public void emailGetterSetterTest(){
  21. PayPal payPal = new PayPal();
  22. payPal.setEmail("John.Jacob@fakeemail.com");
  23. String expected = "John.Jacob@fakeemail.com";
  24. Assert.assertEquals(expected, payPal.getEmail());
  25. }
  26. @Test
  27. public void getShortDescriptionTest(){
  28. PayPal payPal = new PayPal("John Jacob", "john.jacob@fakeemail.com");
  29. String expected = "Paypal John Jacob john.jacob@fakeemail.com";
  30. Assert.assertEquals(expected, payPal.getShortDescription());
  31. }
  32. @Test
  33. public void compareToDifferentPayPalTest(){
  34. PayPal payPal = new PayPal();
  35. PayPal payPal1 = new PayPal();
  36. Assert.assertTrue(payPal.compareTo(payPal1) == 0);
  37. }
  38. @Test
  39. public void compareToCCPayPalTest(){
  40. CreditCard creditCard = new CreditCard("John Jacob", "1234567890123456", 12, 2018);
  41. PayPal payPal = new PayPal();
  42. Assert.assertTrue(payPal.compareTo(creditCard) > 0);
  43. }
  44. }