public void shouldOpenAccount()

in component-test/src/main/java/org/apache/fineract/cn/teller/TestTellerOperation.java [114:146]


  public void shouldOpenAccount() throws Exception {
    final Teller teller = this.prepareTeller();

    final UnlockDrawerCommand unlockDrawerCommand = new UnlockDrawerCommand();
    unlockDrawerCommand.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
    unlockDrawerCommand.setPassword(teller.getPassword());

    super.testSubject.unlockDrawer(teller.getCode(), unlockDrawerCommand);

    super.eventRecorder.wait(EventConstants.AUTHENTICATE_TELLER, teller.getCode());

    final TellerTransaction tellerTransaction =  new TellerTransaction();
    tellerTransaction.setTransactionType(ServiceConstants.TX_OPEN_ACCOUNT);
    tellerTransaction.setTransactionDate(DateConverter.toIsoString(LocalDateTime.now(Clock.systemUTC())));
    tellerTransaction.setProductIdentifier(RandomStringUtils.randomAlphanumeric(32));
    tellerTransaction.setCustomerAccountIdentifier(RandomStringUtils.randomAlphanumeric(32));
    tellerTransaction.setCustomerIdentifier(RandomStringUtils.randomAlphanumeric(32));
    tellerTransaction.setClerk(AbstractTellerTest.TEST_USER);
    tellerTransaction.setAmount(BigDecimal.valueOf(1234.56D));

    final Account account = new Account();
    account.setState(Account.State.OPEN.name());
    Mockito.doAnswer(invocation -> Optional.of(account))
        .when(super.accountingServiceSpy).findAccount(tellerTransaction.getCustomerAccountIdentifier());
    Mockito.doAnswer(invocation -> Collections.emptyList())
        .when(super.depositAccountManagementServiceSpy).getCharges(Matchers.eq(tellerTransaction));
    Mockito.doAnswer(invocation -> Collections.emptyList())
        .when(super.depositAccountManagementServiceSpy).fetchProductInstances(tellerTransaction.getCustomerIdentifier());
    Mockito.doAnswer(invocation -> new ProductDefinition())
        .when(super.depositAccountManagementServiceSpy).findProductDefinition(tellerTransaction.getProductIdentifier());

    super.testSubject.post(teller.getCode(), tellerTransaction);
  }