package com.zipcoder.payment; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class CheckTest { private CreditCard cc; private Paypal pay; private Check ch; @Before public void setUp() throws Exception { ch = new Check(); pay = new Paypal(); cc = new CreditCard(); } @Test public void getID() { //creditCard object Check check = new Check(); //long ID we are testing //Given long ExpectedID = 1234567891; //When check.setID(ExpectedID); //Then long actualID = check.getID(); assertEquals(ExpectedID,actualID); } @Test public void getPayerName() { //creditCard object Check check = new Check(); //Given String ExpectedPayerName = "Tia Mowry"; //When check.setPayerName(ExpectedPayerName); //Then String actualID = check.getPayerName(); assertEquals(ExpectedPayerName,actualID); } @Test public void testRoutingNumber(){ Check check = new Check(); String routingNumber = "00124556"; check.setRoutingNumber(routingNumber); String actual = check.getRoutingNumber(); assertEquals(routingNumber,actual); } @Test public void testAccountNumber(){ Check check = new Check(); String accountNumber = "1234551"; check.setAccountNumber(accountNumber); String actual = check.getAccountNumber(accountNumber); assertEquals(accountNumber,actual); } @Test public void testGetShortDescription(){ Check check = new Check(); String payerName = "Khalil Saboor "; String accountNumber = "***4551"; check.setPayerName(payerName); check.getAccountNumber(accountNumber); check.getRoutingNumber(); String expected = "Check " + payerName + " " + accountNumber; System.out.println(check.getShortDescription()); String actual = check.getShortDescription(); assertEquals(expected,actual); } @Test public void compareTo1(){ int expected = 1; int actual = ch.compareTo(cc); assertEquals(expected,actual); } @Test public void compareTo2(){ int expected = -1; int actual = ch.compareTo(pay); assertEquals(expected,actual); } @Test public void compareTo3(){ int expected = 0; int actual = ch.compareTo(ch); assertEquals(expected,actual); } }