Make OpenAccount#applyEvent match exhaustive (#25890)
This commit is contained in:
parent
70176341d9
commit
3744baf82f
3 changed files with 3 additions and 3 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue