123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.zipcoder.payment;
  2. import org.junit.Test;
  3. import static org.junit.Assert.*;
  4. public class PaypalTest {
  5. @Test
  6. public void getSetId() {
  7. Paypal paypal = new Paypal();
  8. long expected = 12345;
  9. paypal.setId(expected);
  10. long actual = paypal.getId();
  11. assertEquals(expected, actual);
  12. }
  13. @Test
  14. public void getSetPayerName() {
  15. Paypal paypal = new Paypal();
  16. String expected = "John Doe";
  17. paypal.setPayerName(expected);
  18. String actual = paypal.getPayerName();
  19. assertEquals(expected, actual);
  20. }
  21. @Test
  22. public void getSetEmail() {
  23. Paypal paypal = new Paypal();
  24. String expected = "johndoe@alias.com";
  25. paypal.setEmail(expected);
  26. String actual = paypal.getEmail();
  27. assertEquals(expected, actual);
  28. }
  29. @Test
  30. public void getShortDescription() {
  31. Paypal paypal = new Paypal();
  32. paypal.setPayerName("John Doe");
  33. paypal.setEmail("johndoe@alias.com");
  34. String expected = "Paypal John Doe johndoe@alias.com";
  35. String actual = paypal.getShortDescription();
  36. assertEquals(expected, actual);
  37. }
  38. @Test
  39. public void compareToCheckTest() {
  40. Paypal paypal = new Paypal();
  41. paypal.setId(1);
  42. Check check = new Check();
  43. check.setId(2);
  44. int actual = paypal.compareTo(check);
  45. int expected = -1;
  46. assertEquals(expected, actual);
  47. }
  48. @Test
  49. public void compareToCheckTest2() {
  50. Paypal paypal = new Paypal();
  51. paypal.setId(1);
  52. Check check = new Check();
  53. check.setId(1);
  54. int actual = paypal.compareTo(check);
  55. int expected = 0;
  56. assertEquals(expected, actual);
  57. }
  58. @Test
  59. public void compareToCreditCardTest() {
  60. Paypal paypal = new Paypal();
  61. paypal.setId(1);
  62. CreditCard creditCard = new CreditCard();
  63. creditCard.setId(0);
  64. int actual = paypal.compareTo(creditCard);
  65. int expected = 1;
  66. assertEquals(expected, actual);
  67. }
  68. }