public void documentFindTeller()

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


  public void documentFindTeller ( ) throws Exception {

    final String officeIdentifier = "office412";
    final Teller teller = TellerGenerator.createRandomTeller();

    teller.setCode("4123");
    teller.setPassword("assward");
    teller.setTellerAccountIdentifier("TEL412AC");
    teller.setVaultAccountIdentifier("TEL412AC");
    teller.setChequesReceivableAccount("CHA2018AB");
    teller.setCashOverShortAccount("CHA2018AB");
    teller.setAssignedEmployee("Chi Ndohah");
    teller.setCashdrawLimit(new BigDecimal("4"));
    teller.setDenominationRequired(Boolean.FALSE);

    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())
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .accept(MediaType.ALL_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-find-teller", preprocessResponse(prettyPrint()),
                    responseFields(
                            fieldWithPath("code").description("Code"),
                            fieldWithPath("password").type("String").description("Password"),
                            fieldWithPath("cashdrawLimit").type("BigDecimal").description("Cash Withdrawal Limit"),
                            fieldWithPath("tellerAccountIdentifier").description("Teller Account Identifier"),
                            fieldWithPath("vaultAccountIdentifier").description("Vault Account Identifier"),
                            fieldWithPath("chequesReceivableAccount").description("Cheques Receivable Account"),
                            fieldWithPath("cashOverShortAccount").description("Cash Over Short Account"),
                            fieldWithPath("denominationRequired").description("Denomination Required"),
                            fieldWithPath("assignedEmployee").description("Assigned Employee"),
                            fieldWithPath("state").description(" State of Teller " +
                                    " + \n" +
                                    " *enum* _State_ { + \n" +
                                    "    ACTIVE, + \n" +
                                    "    CLOSED, + \n" +
                                    "    OPEN, + \n" +
                                    "    PAUSED + \n" +
                                    "  }"),
                            fieldWithPath("createdBy").description("Employee who created teller"),
                            fieldWithPath("createdOn").description("Date employee was created"),
                            fieldWithPath("lastModifiedBy").type("String").description("Employee who last modified teller"),
                            fieldWithPath("lastModifiedOn").type("String").description("Date when teller was last modified"),
                            fieldWithPath("lastOpenedBy").type("String").description("Last employee who opened teller"),
                            fieldWithPath("lastOpenedOn").type("String").description("Last time teller was opened")
                    )));
  }