Make OpenAccount#applyEvent match exhaustive (#25890)

This commit is contained in:
Dale Wijnand 2018-11-09 08:05:23 +00:00 committed by Johan Andrén
parent 70176341d9
commit 3744baf82f
3 changed files with 3 additions and 3 deletions

View file

@ -114,7 +114,7 @@ object AccountExampleWithCommandHandlersInState {
case Deposited(amount) copy(balance = balance + amount)
case Withdrawn(amount) copy(balance = balance - amount)
case AccountClosed ClosedAccount
case _ throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
case AccountCreated throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
}
def canWithdraw(amount: BigDecimal): Boolean = {

View file

@ -77,7 +77,7 @@ object AccountExampleWithEventHandlersInState {
case Deposited(amount) copy(balance = balance + amount)
case Withdrawn(amount) copy(balance = balance - amount)
case AccountClosed ClosedAccount
case _ throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
case AccountCreated throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
}
def canWithdraw(amount: BigDecimal): Boolean = {

View file

@ -97,7 +97,7 @@ object AccountExampleWithOptionState {
case Deposited(amount) copy(balance = balance + amount)
case Withdrawn(amount) copy(balance = balance - amount)
case AccountClosed ClosedAccount
case _ throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
case AccountCreated throw new IllegalStateException(s"unexpected event [$event] in state [OpenedAccount]")
}
def canWithdraw(amount: BigDecimal): Boolean = {