in component-test/src/main/java/org/apache/fineract/cn/teller/TellerApiDocumentation.java [825:889]
private Teller prepareTeller ( ) throws Exception {
if (this.tellerUnderTest == null) {
final String officeIdentifier = "office" + RandomStringUtils.randomAlphabetic(3);
this.tellerUnderTest = TellerGenerator.createRandomTeller();
tellerUnderTest.setPassword(RandomStringUtils.randomAlphanumeric(12));
final String telAccIdentifier = "telAcc" + RandomStringUtils.randomAlphabetic(3);
tellerUnderTest.setTellerAccountIdentifier(telAccIdentifier);
final String vaulAccIdentifier = "telAcc" + RandomStringUtils.randomAlphabetic(3);
tellerUnderTest.setVaultAccountIdentifier(vaulAccIdentifier);
final String cheqRecAccIdentifier = "cheqRec" + RandomStringUtils.randomAlphabetic(3);
tellerUnderTest.setChequesReceivableAccount(cheqRecAccIdentifier);
final String cashOSAccIdentifier = "cashOSAcc" + RandomStringUtils.randomAlphabetic(3);
tellerUnderTest.setCashOverShortAccount(cashOSAccIdentifier);
final String tellerId = "teller" + RandomStringUtils.randomAlphabetic(3);
tellerUnderTest.setCode(tellerId);
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(this.tellerUnderTest.getTellerAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(this.tellerUnderTest.getVaultAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(this.tellerUnderTest.getChequesReceivableAccount()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(this.tellerUnderTest.getCashOverShortAccount()));
super.testSubject.create(officeIdentifier, this.tellerUnderTest);
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, this.tellerUnderTest.getCode()));
Mockito.verify(this.organizationServiceSpy, Mockito.times(1)).setTellerReference(Matchers.eq(officeIdentifier));
final TellerManagementCommand command = new TellerManagementCommand();
command.setAction(TellerManagementCommand.Action.OPEN.name());
command.setAdjustment(TellerManagementCommand.Adjustment.NONE.name());
command.setAssignedEmployeeIdentifier(AbstractTellerTest.TEST_USER);
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).employeeExists(Matchers.eq(command.getAssignedEmployeeIdentifier()));
super.testSubject.post(officeIdentifier, this.tellerUnderTest.getCode(), command);
Assert.assertTrue(super.eventRecorder.wait(EventConstants.OPEN_TELLER, this.tellerUnderTest.getCode()));
}
final ProductInstance productInstance = new ProductInstance();
productInstance.setProductIdentifier(RandomStringUtils.randomAlphanumeric(32));
productInstance.setBalance(0.00D);
Mockito.doAnswer(invocation -> productInstance)
.when(super.depositAccountManagementServiceSpy).findProductInstance(Matchers.anyString());
final ProductDefinition productDefinition = new ProductDefinition();
productDefinition.setMinimumBalance(0.00D);
Mockito.doAnswer(invocation -> productDefinition)
.when(super.depositAccountManagementServiceSpy).findProductDefinition(Matchers.eq(productInstance.getProductIdentifier()));
return this.tellerUnderTest;
}