public void documentUpdateTeller()

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


  public void documentUpdateTeller ( ) throws Exception {

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

    teller.setCode("6789");
    teller.setPassword(RandomStringUtils.randomAlphabetic(9));
    teller.setTellerAccountIdentifier("TEL6789Z1");
    teller.setVaultAccountIdentifier("TEL6789Z1");
    teller.setChequesReceivableAccount("ZHX2018ABZ");
    teller.setCashOverShortAccount("ZHX2018ABZ");
    teller.setAssignedEmployee("Dioh Dione");
    teller.setCashdrawLimit(new BigDecimal("5000000"));
    teller.setDenominationRequired(Boolean.TRUE);

    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);

    super.eventRecorder.wait(EventConstants.POST_TELLER, teller.getCode());

    teller.setCashdrawLimit(BigDecimal.valueOf(15000.00D));

    Gson gson = new Gson();
    this.mockMvc.perform(put("/offices/" + officeIdentifier + "/teller/" + teller.getCode())
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(gson.toJson(teller))
            .accept(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(status().isAccepted())
            .andDo(document("document-update-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")
                    )));
  }