in component-test/src/main/java/org/apache/fineract/cn/teller/TestTellerOperation.java [431:479]
private Teller prepareTeller() throws Exception {
if (TestTellerOperation.tellerUnderTest == null) {
final String officeIdentifier = RandomStringUtils.randomAlphabetic(32);
TestTellerOperation.tellerUnderTest = TellerGenerator.createRandomTeller();
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(TestTellerOperation.tellerUnderTest.getTellerAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(TestTellerOperation.tellerUnderTest.getVaultAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(TestTellerOperation.tellerUnderTest.getChequesReceivableAccount()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(TestTellerOperation.tellerUnderTest.getCashOverShortAccount()));
super.testSubject.create(officeIdentifier, TestTellerOperation.tellerUnderTest);
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, TestTellerOperation.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, TestTellerOperation.tellerUnderTest.getCode(), command);
Assert.assertTrue(super.eventRecorder.wait(EventConstants.OPEN_TELLER, TestTellerOperation.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 TestTellerOperation.tellerUnderTest;
}