@Test public void checkAccountActivityWithdrawal() { Account a = new Account(Account.CHECKING); a.deposit(10); a.withdraw(5); assertFalse(a.accountInactive()); }
@Test public void testTransactions() { Account a = new Account(Account.SAVINGS); a.deposit(100.5); a.withdraw(50.5); double balance = a.sumTransactions(); assertEquals(50.0, balance, DOUBLE_DELTA); }
@Before public void setUp() throws Exception { SEK = new Currency("SEK", 0.15); SweBank = new Bank("SweBank", SEK); SweBank.openAccount("Alice"); testAccount = new Account("Hans", SEK); testAccount.deposit(new Money(10000000, SEK)); SweBank.deposit("Alice", new Money(1000000, SEK)); }
@Test public void testAddWithdraw() { // Amount before deposit and withdraw int preTransferAmountTestaccount = testAccount.getBalance().getAmount(); // Try to deposit 200 and check if desired value testAccount.deposit(new Money(200, SEK)); assertEquals( preTransferAmountTestaccount + 200, testAccount.getBalance().getAmount().intValue()); // Try to withdraw 200 and check value testAccount.withdraw(new Money(200, SEK)); assertEquals(preTransferAmountTestaccount, testAccount.getBalance().getAmount().intValue()); }
@Test public void checkAccountActivityDeposit() { Account a = new Account(Account.CHECKING); a.deposit(10); assertTrue(a.accountInactive()); }
@Test(expected = IllegalArgumentException.class) public void testDepositIllegalArgumentException() { Account a = new Account(Account.SAVINGS); a.deposit(-2); }