in component-test/src/main/java/org/apache/fineract/cn/accounting/AccountApiDocumentation.java [567:641]
public void documentFindAccountWithAlternativeAccountNumber ( ) throws Exception {
Set <String> holdersList = new HashSet <>();
String holderOne = "Only Holder";
holdersList.add(holderOne);
Set <String> signatories = new HashSet <>();
String signatureOne = "Only Signatory";
signatories.add(signatureOne);
final Ledger ledger = LedgerGenerator.createRandomLedger();
ledger.setIdentifier("7100");
ledger.setType(AccountType.REVENUE.name());
this.testSubject.createLedger(ledger);
this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
final String altNumber = "7-1-0-0-.-1-0";
final Account salesAccount = AccountGenerator.createAccount(
"7100", "7100.10", AccountType.REVENUE);
salesAccount.setState(Account.State.OPEN.name());
salesAccount.setName("Organic Maize");
salesAccount.setHolders(holdersList);
salesAccount.setSignatureAuthorities(signatories);
salesAccount.setBalance(3435.0);
salesAccount.setState(Account.State.CLOSED.name());
salesAccount.setAlternativeAccountNumber(altNumber);
this.testSubject.createAccount(salesAccount);
this.eventRecorder.wait(EventConstants.POST_ACCOUNT, salesAccount.getIdentifier());
final AccountPage accountPage =
this.testSubject.fetchAccounts(true, altNumber, null, true,
0, 3, null, null);
Gson gson = new Gson();
this.mockMvc.perform(get("/accounts/" + salesAccount.getIdentifier())
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.ALL_VALUE)
/*.content(gson.toJson())*/)
.andExpect(status().isOk())
.andDo(document("document-find-account-with-alternative-account-number", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
responseFields(
fieldWithPath("type").description("AccountType").description("Type of Account " +
" + \n" +
" + \n" +
" *enum* _AccountType_ { + \n" +
" ASSET, + \n" +
" LIABILITY, + \n" +
" EQUITY, + \n" +
" REVENUE, + \n" +
" EXPENSE + \n" +
"}"),
fieldWithPath("identifier").type("String").description("Account identifier"),
fieldWithPath("name").type("String").description("Account name"),
fieldWithPath("holders").type("Set<String>").description("Set of account holders"),
fieldWithPath("signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
fieldWithPath("balance").type("Double").description("account's balance"),
fieldWithPath("referenceAccount").type("String").description("Reference Account"),
fieldWithPath("ledger").type("String").description("Associated ledger"),
fieldWithPath("state").type("State").description("State of Account " +
" + \n" +
" + \n" +
" *enum* _State_ { + \n" +
" OPEN, + \n" +
" LOCKED, + \n" +
" CLOSED, + \n" +
"}"),
fieldWithPath("alternativeAccountNumber").type("Integer").description("Total accounts in page"),
fieldWithPath("createdOn").type("List<Account>").description("List of Accounts"),
fieldWithPath("createdBy").type("Integer").description("Total number of pages"),
fieldWithPath("lastModifiedOn").type("String").description("Total number of elements"),
fieldWithPath("lastModifiedBy").type("String").description("Total number of elements")
)));
}