-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathBankTest.scala
More file actions
40 lines (33 loc) · 1.25 KB
/
BankTest.scala
File metadata and controls
40 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.abc
import org.scalatest.{Matchers, FlatSpec}
import com.abc.AccountType._
class BankTest extends FlatSpec with Matchers {
"Bank" should "customer summary" in {
val bank: Bank = new Bank
var john: Customer = new Customer("John").openAccount(new MyAccount(CHECKING))
bank.addCustomer(john)
bank.customerSummary should be("Customer Summary\n - John (1 account)")
}
it should "checking account" in {
val bank: Bank = new Bank
val checkingAccount: MyAccount = new MyAccount(CHECKING)
val bill: Customer = new Customer("Bill").openAccount(checkingAccount)
bank.addCustomer(bill)
checkingAccount.deposit(100.0)
bank.totalInterestPaid should be(0.0)
}
it should "savings account" in {
val bank: Bank = new Bank
val checkingAccount: MyAccount = new MyAccount(SAVINGS)
bank.addCustomer(new Customer("Bill").openAccount(checkingAccount))
checkingAccount.deposit(1500.0)
bank.totalInterestPaid should be(0.0)
}
it should "maxi savings account" in {
val bank: Bank = new Bank
val checkingAccount: MyAccount = new MyAccount(MAXI_SAVINGS)
bank.addCustomer(new Customer("Bill").openAccount(checkingAccount))
checkingAccount.deposit(3000.0)
bank.totalInterestPaid should be(0.0)
}
}