private void prepareMocks()

in component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java [183:201]


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

    final Account mainAccount = new Account();
    mainAccount.setState(Account.State.OPEN.name());
    Mockito
        .doAnswer(invocation -> Optional.of(mainAccount))
        .when(this.accountingAdaptorSpy).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.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
    });
  }