in component-test/src/main/java/org/apache/fineract/cn/teller/TestTellerManagement.java [176:212]
public void shouldFetchTeller() throws Exception {
final String officeIdentifier = RandomStringUtils.randomAlphabetic(32);
final List<Teller> tellerToCreate = Arrays.asList(
TellerGenerator.createRandomTeller(),
TellerGenerator.createRandomTeller(),
TellerGenerator.createRandomTeller(),
TellerGenerator.createRandomTeller(),
TellerGenerator.createRandomTeller()
);
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
tellerToCreate.forEach(teller -> {
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getTellerAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getVaultAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getChequesReceivableAccount()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getCashOverShortAccount()));
super.testSubject.create(officeIdentifier, teller);
try {
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, teller.getCode()));
} catch (final InterruptedException e) {
throw new IllegalStateException(e);
}
});
final List<Teller> fetchedTeller = super.testSubject.fetch(officeIdentifier);
Assert.assertTrue(fetchedTeller.size() >= tellerToCreate.size());
}