public void documentGetBalance()

in component-test/src/main/java/org/apache/fineract/cn/teller/TellerApiDocumentation.java [513:549]


  public void documentGetBalance ( ) throws Exception {

    final String officeIdentifier = "fesse";
    final Teller teller = TellerGenerator.createRandomTeller();
    teller.setCode("kombone987");
    teller.setCashdrawLimit(BigDecimal.valueOf(10000.00D));

    Mockito.doAnswer(invocation -> true)
            .when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));

    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getTellerAccountIdentifier()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getVaultAccountIdentifier()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getChequesReceivableAccount()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getCashOverShortAccount()));

    super.testSubject.create(officeIdentifier, teller);
    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, teller.getCode()));

    this.mockMvc.perform(get("/offices/" + officeIdentifier + "/teller/" + teller.getCode() + "/balance")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .accept(MediaType.ALL_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-get-balance", preprocessResponse(prettyPrint()),
                    responseFields(
                            fieldWithPath("day").type("String").description("Code"),
                            fieldWithPath("cashOnHand").type("BigDecimal").description("Password"),
                            fieldWithPath("cashReceivedTotal").type("BigDecimal").description("Cash Withdrawal Limit"),
                            fieldWithPath("cashDisbursedTotal").type("BigDecimal").description("Teller Account Identifier"),
                            fieldWithPath("chequesReceivedTotal").type("BigDecimal").description("Vault Account Identifier"),
                            fieldWithPath("cashEntries").type("List<TellerEntry>").description("Cheques Receivable Account"),
                            fieldWithPath("chequeEntries").type("List<TellerEntry>").description("Cash Over Short Account")
                    )));
  }