Skip to content

Instantly share code, notes, and snippets.

@emag
Created December 8, 2024 13:20
Show Gist options
  • Save emag/b010fcc8e3bf458bca7bd9c70170573f to your computer and use it in GitHub Desktop.
Save emag/b010fcc8e3bf458bca7bd9c70170573f to your computer and use it in GitHub Desktop.
仕訳の記帳が拒否されるパターン
"負数の残高にはできない" in {
// Given
val initA = Map(Cash -> BigDecimal(1_000_000))
val initL = Map.empty[AccountTitle, BigDecimal]
val entry = JournalEntry(
date = LocalDate.now(),
debit = BankAccount,
credit = Cash,
amount = BigDecimal(2_000_000),
description = "入金"
)
// When
val result = BalanceSheet.NotReady
.initialize(initA, initL)
.flatMap(_.journalize(entry))
// Then
result shouldBe Rejected(NonEmptyChain(NegativeBalance))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment