FINERACT-1724
- fixes the JPA exception which is raised when a message was redelivered and earlier all the loans got closed for that given partition.
This commit is contained in:
committed by
Arnold Gálovics
parent
f12430752f
commit
a45ff9a3e0
@@ -101,6 +101,27 @@ class LoanItemReaderTest {
|
||||
Mockito.verifyNoMoreInteractions(loanRepository);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoanItemReadNoOpenLoansFound() throws Exception {
|
||||
// given
|
||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "test", "test", "UTC", null));
|
||||
LoanItemReader loanItemReader = new LoanItemReader(loanRepository, retrieveLoanIdService, customJobParameterResolver,
|
||||
loanLockingService);
|
||||
when(stepExecution.getExecutionContext()).thenReturn(executionContext);
|
||||
LoanCOBParameter loanCOBParameter = new LoanCOBParameter(1L, 5L);
|
||||
when(executionContext.get(LoanCOBConstant.LOAN_COB_PARAMETER)).thenReturn(loanCOBParameter);
|
||||
when(retrieveLoanIdService.retrieveAllNonClosedLoansByLastClosedBusinessDateAndMinAndMaxLoanId(loanCOBParameter, false))
|
||||
.thenReturn(new ArrayList<>(List.of()));
|
||||
|
||||
// when + then
|
||||
loanItemReader.beforeStep(stepExecution);
|
||||
Loan myLoan = loanItemReader.read();
|
||||
Assertions.assertNull(myLoan);
|
||||
|
||||
Mockito.verifyNoMoreInteractions(loanRepository);
|
||||
Mockito.verifyNoInteractions(loanLockingService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoanItemReaderMultiThreadRead() throws Exception {
|
||||
// given
|
||||
|
||||
Reference in New Issue
Block a user