private void prepareDistributionMocks()

in component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java [394:412]


  private void prepareDistributionMocks (final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
    Mockito
            .doAnswer(invocation -> Optional.of(new Customer()))
            .when(this.customerAdaptor).findCustomer(Matchers.eq(customerIdentifier));

    final Account mainAccount = new Account();
    mainAccount.setState(Account.State.OPEN.name());
    Mockito
            .doAnswer(invocation -> Optional.of(mainAccount))
            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));

    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
      final Account allocatedAccount = new Account();
      allocatedAccount.setState(Account.State.OPEN.name());
      Mockito
              .doAnswer(invocation -> Optional.of(allocatedAccount))
              .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
    });
  }