in component-test/src/main/java/org/apache/fineract/cn/cheque/TestCheques.java [229:263]
public void shouldProcessOpenCheque() throws Exception {
final Cheque randomCheque = Fixture.createRandomCheque();
randomCheque.setOpenCheque(Boolean.TRUE);
Mockito
.doAnswer(invocation -> false)
.when(this.organizationServiceSpy).officeExistsByBranchSortCode(randomCheque.getMicr().getBranchSortCode());
Mockito
.doAnswer(invocation -> false)
.when(this.accountingServiceSpy).accountExists(randomCheque.getMicr().getAccountNumber());
Mockito.doAnswer(invocation -> {
final JournalEntry journalEntry = invocation.getArgument(0);
final BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(journalEntry, "journalEntry");
this.validator.validate(journalEntry, bindingResult);
if (bindingResult.getErrorCount() != 0) {
bindingResult.getAllErrors().forEach(objectError -> {
System.out.println(objectError.toString());
});
}
return invocation.getMethod().getReturnType();
}).when(this.accountingServiceSpy).processJournalEntry(Matchers.any(JournalEntry.class));
final ChequeTransaction chequeTransaction = new ChequeTransaction();
chequeTransaction.setChequesReceivableAccount(RandomStringUtils.randomAlphabetic(34));
chequeTransaction.setCheque(randomCheque);
chequeTransaction.setCreditorAccountNumber(RandomStringUtils.randomAlphanumeric(34));
super.chequeManager.process(chequeTransaction);
Assert.assertTrue(
super.eventRecorder.wait(EventConstants.CHEQUE_TRANSACTION, MICRParser.toIdentifier(randomCheque.getMicr()))
);
}