FINERACT-2354: Validation of Re-age amount during submission
This commit is contained in:
committed by
Adam Saghy
parent
4c22e2a9fc
commit
a58bdf49b6
+29
@@ -70,6 +70,9 @@ class LoanReAgingValidatorTest {
|
||||
@Mock
|
||||
private LoanTransactionRepository loanTransactionRepository;
|
||||
|
||||
@Mock
|
||||
private FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@InjectMocks
|
||||
private LoanReAgingValidator underTest;
|
||||
|
||||
@@ -288,6 +291,32 @@ class LoanReAgingValidatorTest {
|
||||
.isEqualTo("validation.msg.loan.reAge.numberOfInstallments.not.greater.than.zero");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateReAge_ShouldThrowException_WhenTransactionAmountIsZero() {
|
||||
// given
|
||||
Loan loan = loan();
|
||||
JsonCommand command = makeJsonCommand("""
|
||||
{
|
||||
"externalId": "12345",
|
||||
"dateFormat": "%s",
|
||||
"locale": "en",
|
||||
"startDate": "%s",
|
||||
"frequencyType": "MONTHS",
|
||||
"frequencyNumber": 1,
|
||||
"numberOfInstallments": 1,
|
||||
"transactionAmount": 0
|
||||
}
|
||||
""".formatted(DATE_FORMAT, formatDate(afterMaturity)));
|
||||
// when
|
||||
PlatformApiDataValidationException result = assertThrows(PlatformApiDataValidationException.class,
|
||||
() -> underTest.validateReAge(loan, command));
|
||||
// then
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.getGlobalisationMessageCode()).isEqualTo("validation.msg.validation.errors.exist");
|
||||
assertThat(result.getErrors().getFirst().getUserMessageGlobalisationCode())
|
||||
.isEqualTo("validation.msg.loan.reAge.transactionAmount.not.greater.than.zero");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateReAge_ShouldThrowException_WhenStartDateIsBeforeMaturity() {
|
||||
// given
|
||||
|
||||
Reference in New Issue
Block a user