FINERACT-1971
- validation added for the case when advanced repayment strategy is used with empty or missing allocation rules.
This commit is contained in:
+15
-1
@@ -68,7 +68,21 @@ class AdvancedPaymentAllocationsJsonParserTest {
|
||||
|
||||
// then
|
||||
Assertions.assertNull(loanProductPaymentAllocationRules);
|
||||
Mockito.verifyNoInteractions(advancedPaymentAllocationsValidator);
|
||||
Mockito.verify(advancedPaymentAllocationsValidator, times(1)).validate(null, "other-strategy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullAllocationRuleJson() throws JsonProcessingException {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
JsonCommand command = createJsonCommand(map);
|
||||
|
||||
// when
|
||||
List<LoanProductPaymentAllocationRule> loanProductPaymentAllocationRules = advancedPaymentAllocationsJsonParser
|
||||
.assembleLoanProductPaymentAllocationRules(command, "advanced-payment-allocation-strategy");
|
||||
|
||||
// then
|
||||
Assertions.assertNull(loanProductPaymentAllocationRules);
|
||||
Mockito.verify(advancedPaymentAllocationsValidator, times(1)).validate(null, "advanced-payment-allocation-strategy");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+16
@@ -80,6 +80,22 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
underTest.validate(List.of(lppr1, lppr2), ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateEmptyRuleList() {
|
||||
assertPlatformValidationException(
|
||||
"Advanced-payment-allocation-strategy was selected but no DEFAULT payment allocation was provided",
|
||||
"advanced-payment-strategy-without-default-payment-allocation",
|
||||
() -> underTest.validate(List.of(), ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateMissingList() {
|
||||
assertPlatformValidationException(
|
||||
"Advanced-payment-allocation-strategy was selected but no DEFAULT payment allocation was provided",
|
||||
"advanced-payment-strategy-without-default-payment-allocation",
|
||||
() -> underTest.validate(null, ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidatePaymentAllocationThrowsErrorWhenNoDefault() {
|
||||
LoanProductPaymentAllocationRule lppr2 = createLoanProductAllocationRule2();
|
||||
|
||||
Reference in New Issue
Block a user