import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class AccountTest. * * @author (your name) * @version (a version number or a date) */ public class AccountTest { /** * Default constructor for test class AccountTest */ public AccountTest() { } /** * Sets up the test fixture. * * Called before every test case method. */ @Before public void setUp() { } /** * Tears down the test fixture. * * Called after every test case method. */ @After public void tearDown() { } @Test public void testdeposit(){ int expected = 50; Account ac = new Account(40); ac.deposit(10); int actual = ac.balance(); assertEquals(expected, actual); } @Test public void testtransfer(){ int expected_myAc = 30; int expected_friendAc = 40; Account myAc = new Account(40); Account friendAcc = new Account(30); myAc.transfer(friendAcc, 10); int actual_myAc = myAc.balance(); int actual_friendAc = friendAcc.balance(); assertEquals(expected_myAc, actual_myAc); assertEquals(expected_friendAc, actual_friendAc); } @Test public void testbalance(){ int expected = 30; Account ac = new Account(30); int actual = ac.balance(); assertEquals(expected, actual); } }