|
|
|
|
@ -71,7 +71,7 @@ class MybatisIssuanceRequestRepositoryTest {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void readsSuggestedAmountAsThresholdMinusCurrentBalance() {
|
|
|
|
|
IssuanceBankInventory inventory = repository.findInventoryByBankCode("BKCHCNBJ00001")
|
|
|
|
|
IssuanceBankInventory inventory = repository.findBuiltInInventory()
|
|
|
|
|
.orElseThrow(() -> new AssertionError("seeded bank inventory was not found"));
|
|
|
|
|
|
|
|
|
|
assertThat(inventory.getCurrentBalance()).isEqualByComparingTo("49950000.00");
|
|
|
|
|
@ -79,21 +79,6 @@ class MybatisIssuanceRequestRepositoryTest {
|
|
|
|
|
assertThat(inventory.getSuggestedSupplementAmount()).isEqualByComparingTo("50000.00");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void clampsSuggestedAmountToZeroWhenBalanceExceedsThreshold() {
|
|
|
|
|
IssuanceBankInventoryEntity inventory = new IssuanceBankInventoryEntity();
|
|
|
|
|
inventory.setBankCode("BKCLAMP00001");
|
|
|
|
|
inventory.setCurrentBalance(new BigDecimal("60000000.00"));
|
|
|
|
|
inventory.setWarningThreshold(new BigDecimal("50000000.00"));
|
|
|
|
|
inventory.setUpdatedAt(java.time.LocalDateTime.now());
|
|
|
|
|
inventoryMapper.insert(inventory);
|
|
|
|
|
|
|
|
|
|
IssuanceBankInventory restored = repository.findInventoryByBankCode("BKCLAMP00001")
|
|
|
|
|
.orElseThrow(() -> new AssertionError("inventory was not restored"));
|
|
|
|
|
|
|
|
|
|
assertThat(restored.getSuggestedSupplementAmount()).isEqualByComparingTo("0.00");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void savingChangedDraftReplacesRatherThanAccumulatesDenominations() {
|
|
|
|
|
UUID id = UUID.randomUUID();
|
|
|
|
|
|