corda-training-solutions
corda-training-solutions copied to clipboard
A testcase is missing for a full settlement to a partially settled IOU
In excercise of IOUContract.kt
, I had erroneously ignored paid amount on settlement contract, i.e.
// wrong
val amountOutstanding = inputIou.amount
// correct
val amountOutstanding = inputIou.amount - inputIou.paid
IOUSettleTests.kt
couldn't detect the error.
We needed a test case where we will fully settle an IOU that was partially settled, e.g.
- Issue an IOU $10 -> output: one IOU (amount=10, paid=0)
- Then settle $5 -> output: one IOU (amount=10, paid=5)
- Then settle $5 -> no IOU output