public void documentModifyAccount()

in component-test/src/main/java/org/apache/fineract/cn/accounting/AccountApiDocumentation.java [644:703]


  public void documentModifyAccount ( ) throws Exception {

    final Ledger ledger = LedgerGenerator.createRandomLedger();
    ledger.setIdentifier("2000");
    this.testSubject.createLedger(ledger);
    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());

    final Account account = AccountGenerator.createRandomAccount(ledger.getIdentifier());

    Set <String> holdersList = new HashSet <>();
    String holderOne = "Holder First";
    String holderTwo = "Holder Second";
    holdersList.add(holderOne);
    holdersList.add(holderTwo);

    Set <String> signatories = new HashSet <>();
    String signatureOne = "First Signatory";
    String signatureTwo = "Second Signatory";
    signatories.add(signatureOne);
    signatories.add(signatureTwo);

    Double bal = 342.0;

    account.setType(AccountType.ASSET.name());
    account.setIdentifier("2001");
    account.setName("Payables");
    account.setHolders(holdersList);
    account.setSignatureAuthorities(signatories);
    account.setBalance(bal);
    account.setLedger(ledger.getIdentifier());

    this.testSubject.createAccount(account);
    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, account.getIdentifier());

    Gson gson = new Gson();
    this.mockMvc.perform(put("/accounts/" + account.getIdentifier())
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .accept(MediaType.APPLICATION_JSON_VALUE)
            .content(gson.toJson(account)))
            .andExpect(status().isAccepted())
            .andDo(document("document-modify-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
                    requestFields(
                            fieldWithPath("type").description("Type of Account " +
                                    " + \n" +
                                    " + \n" +
                                    " *enum* _AccountType_ { + \n" +
                                    "  ASSET, + \n" +
                                    "  LIABILITY, + \n" +
                                    "  EQUITY, + \n" +
                                    "  REVENUE, + \n" +
                                    "  EXPENSE + \n" +
                                    "}"),
                            fieldWithPath("identifier").description("Account identifier"),
                            fieldWithPath("name").description("Name of account"),
                            fieldWithPath("holders").type("Set<String>").description("Account Holders"),
                            fieldWithPath("signatureAuthorities").type("Set<String>").description("Account signatories"),
                            fieldWithPath("balance").type("Double").description("Account balance"),
                            fieldWithPath("ledger").description("Associated ledger")
                    )));
  }