public void documentCreateTeller()

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


  public void documentCreateTeller ( ) throws Exception {

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

    teller.setCode("1234");
    teller.setPassword("password");
    teller.setTellerAccountIdentifier("TEL123BA");
    teller.setVaultAccountIdentifier("TEL123BA");
    teller.setChequesReceivableAccount("CHA2018XYZ");
    teller.setCashOverShortAccount("CHA2018XYZ");
    teller.setAssignedEmployee("Nakuve Lah");
    teller.setCashdrawLimit(new BigDecimal("5000000"));
    teller.setDenominationRequired(Boolean.FALSE);


    Mockito.doAnswer(invocation -> true)
            .when(this.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(this.accountingService).findAccount(Matchers.eq(teller.getTellerAccountIdentifier()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(this.accountingService).findAccount(Matchers.eq(teller.getVaultAccountIdentifier()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(this.accountingService).findAccount(Matchers.eq(teller.getChequesReceivableAccount()));
    Mockito.doAnswer(invocation -> Optional.of(new Account()))
            .when(this.accountingService).findAccount(Matchers.eq(teller.getCashOverShortAccount()));

    Gson gson = new Gson();
    this.mockMvc.perform(post("/offices/" + officeIdentifier + "/teller/")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(gson.toJson(teller))
            .accept(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(status().isAccepted())
            .andDo(document("document-create-teller", preprocessRequest(prettyPrint()),
                    requestFields(
                            fieldWithPath("code").description("Code"),
                            fieldWithPath("password").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")
                    )));
  }