in component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java [264:301]
public void documentAddSubLedger ( ) throws Exception {
final Ledger parentLedger = LedgerGenerator.createRandomLedger();
parentLedger.setIdentifier("6220");
parentLedger.setName("Name of" + parentLedger.getIdentifier());
parentLedger.setDescription("Description of " + parentLedger.getIdentifier());
this.testSubject.createLedger(parentLedger);
this.eventRecorder.wait(EventConstants.POST_LEDGER, parentLedger.getIdentifier());
final Ledger subLedger = LedgerGenerator.createRandomLedger();
subLedger.setIdentifier("6221");
subLedger.setName("SubLedger One of " + parentLedger.getIdentifier());
subLedger.setDescription("First Sub Ledger of " + parentLedger.getIdentifier());
Gson gson = new Gson();
this.mockMvc.perform(post("/ledgers/" + parentLedger.getIdentifier())
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE)
.content(gson.toJson(subLedger)))
.andExpect(status().isAccepted())
.andDo(document("document-add-sub-ledger", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
requestFields(
fieldWithPath("type").description("Type of Ledger " +
" + \n" +
" + \n" +
" *enum* _AccountType_ { + \n" +
" ASSET, + \n" +
" LIABILITY, + \n" +
" EQUITY, + \n" +
" REVENUE, + \n" +
" EXPENSE + \n" +
"}"),
fieldWithPath("identifier").description("Sub Ledger identifier"),
fieldWithPath("name").description("Name of sub ledger"),
fieldWithPath("description").description("Description of sub ledger"),
fieldWithPath("showAccountsInChart").type("Boolean").description("Should ledger be shown in charts ?")
)));
}