CompareToTest.java 1017B

12345678910111213141516171819202122232425262728293031323334
  1. package com.zipcoder.payment;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.assertEquals;
  4. import static org.junit.jupiter.api.Assertions.assertTrue;
  5. public class CompareToTest {
  6. @Test
  7. public void compareToNegativeTest(){
  8. Check myCheck = new Check("Dan Rivas", "1243567895");
  9. PayPal pp = new PayPal("Shane McNaulty", "shane@loews.com");
  10. int actual = myCheck.compareTo(pp);
  11. assertTrue(actual < 0);
  12. }
  13. @Test
  14. public void compareToPositiveTest(){
  15. Check myCheck = new Check("Dan Rivas", "1243567895");
  16. PayPal pp = new PayPal("Shane McNaulty", "shane@loews.com");
  17. int actual = pp.compareTo(myCheck);
  18. assertTrue(actual > 0);
  19. }
  20. @Test
  21. public void compareToZeroTest(){
  22. Payment myCheck = new Check("Dan Rivas", "1243567876");
  23. Payment yourCheck = new Check("Dan Rivas", "1243567876");
  24. int actual = myCheck.compareTo(yourCheck);
  25. assertEquals(0, actual);
  26. }
  27. }