You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2018/09/06 09:11:00 UTC

[GitHub] awasum closed pull request #7: Document APIs for transaction types, journal entries, accounts and le…

awasum closed pull request #7: Document APIs for transaction types, journal entries, accounts and le…
URL: https://github.com/apache/fineract-cn-accounting/pull/7
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index 5e1104b..0cd4b09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,10 @@
 .idea
 **/build/
 **/target/
+api/out/
+component-test/out/
+importer/out/
+service/out/
 
 # Ignore Gradle GUI config
 gradle-app.setting
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 64d0d9b..411086c 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -26,6 +26,7 @@ buildscript {
 
     dependencies {
         classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+        classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
     }
 }
 
@@ -35,6 +36,7 @@ plugins {
 }
 
 apply from: '../shared.gradle'
+apply plugin: 'org.asciidoctor.convert'
 
 dependencies {
     compile(
@@ -45,10 +47,20 @@ dependencies {
             [group: 'org.apache.fineract.cn', name: 'api', version: versions.frameworkapi],
             [group: 'org.apache.fineract.cn', name: 'test', version: versions.frameworktest],
             [group: 'org.apache.fineract.cn', name: 'lang', version: versions.frameworklang],
-            [group: 'org.springframework.boot', name: 'spring-boot-starter-test']
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
+            [group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
+            [group: 'junit', name: 'junit', version: '4.12']
     )
 }
 
+asciidoctor {
+    sourceDir 'build/doc/asciidoc/'
+    outputDir 'build/doc/html5/'
+    options backend: "html", doctype: "book"
+    attributes "source-highlighter": "highlightjs", \
+                'snippets': file('build/doc/generated-snippets/')
+}
+
 publishing {
     publications {
         mavenJava(MavenPublication) {
diff --git a/component-test/src/main/java/org/apache/fineract/cn/accounting/AccountApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/accounting/AccountApiDocumentation.java
new file mode 100644
index 0000000..d461f2c
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/accounting/AccountApiDocumentation.java
@@ -0,0 +1,1019 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import com.google.gson.Gson;
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.*;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.apache.fineract.cn.lang.DateRange;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.math.BigDecimal;
+import java.time.Clock;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+
+public class AccountApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("build/doc/generated-snippets/test-account");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentCreateAccount ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+
+    ledger.setType(AccountType.ASSET.name());
+    ledger.setIdentifier("1111");
+    ledger.setName("Receivables");
+    ledger.setDescription("Receivables Account");
+
+    Ledger rentsReceivable = LedgerGenerator.createLedger("10011", AccountType.ASSET);
+    Ledger tradeReceivables = LedgerGenerator.createLedger("10012", AccountType.ASSET);
+    List <Ledger> subLedgers = new ArrayList <>();
+    subLedgers.add(rentsReceivable);
+    subLedgers.add(tradeReceivables);
+
+    BigDecimal value = new BigDecimal(1000000);
+    ledger.setTotalValue(value);
+    ledger.setCreatedOn(LocalDate.ofYearDay(2017, 17).toString());
+    ledger.setCreatedBy("Epie E.");
+    ledger.setLastModifiedOn(LocalDate.ofYearDay(2018, 160).toString());
+    ledger.setLastModifiedBy("Epie Ngome");
+    ledger.setShowAccountsInChart(Boolean.TRUE);
+
+    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 = "First Holder";
+    String holderTwo = "Second Holder";
+    holdersList.add(holderOne);
+    holdersList.add(holderTwo);
+
+    Set <String> signatories = new HashSet <>();
+    String signatureOne = "First To Sign";
+    String signatureTwo = "Second To Sign";
+    signatories.add(signatureOne);
+    signatories.add(signatureTwo);
+
+    Double bal = 105.0;
+
+    account.setType(AccountType.ASSET.name());
+    account.setIdentifier("10013");
+    account.setName("Interest Receivables");
+    account.setHolders(holdersList);
+    account.setSignatureAuthorities(signatories);
+    account.setBalance(bal);
+    account.setLedger(ledger.getIdentifier());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/accounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(account)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-create-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")
+                    )));
+  }
+
+  @Test
+  public void documentFindAccount ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("1001");
+
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account referenceAccount = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    referenceAccount.setIdentifier("1000");
+    this.testSubject.createAccount(referenceAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, referenceAccount.getIdentifier());
+
+    final Account account = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+
+    Set <String> holdersList = new HashSet <>();
+    String holderOne = "Holder One";
+    String holderTwo = "Holder Two";
+    holdersList.add(holderOne);
+    holdersList.add(holderTwo);
+
+    Set <String> signatories = new HashSet <>();
+    String signatureOne = "Signatory One";
+    String signatureTwo = "Signatory Two";
+    signatories.add(signatureOne);
+    signatories.add(signatureTwo);
+
+    Double bal = 906.4;
+
+    account.setType(AccountType.ASSET.name());
+    account.setIdentifier("1001");
+    account.setName("Receivables");
+    account.setHolders(holdersList);
+    account.setSignatureAuthorities(signatories);
+    account.setBalance(bal);
+    account.setLedger(ledger.getIdentifier());
+
+    account.setReferenceAccount(referenceAccount.getIdentifier());
+    this.testSubject.createAccount(account);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, account.getIdentifier());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/accounts/" + account.getIdentifier())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE)
+            .content(gson.toJson(account)))
+            .andExpect(status().isOk())
+            .andDo(document("document-find-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            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"),
+                            fieldWithPath("referenceAccount").description("Reference Account"),
+                            fieldWithPath("state").description("State of account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    "*enum* _State_ {\n" +
+                                    "    OPEN, + \n" +
+                                    "    LOCKED, + \n" +
+                                    "    CLOSED + \n" +
+                                    "  }"),
+                            fieldWithPath("alternativeAccountNumber").type("String").description("Alternative account"),
+                            fieldWithPath("createdOn").description("Date account was created"),
+                            fieldWithPath("createdBy").description("Account creator"),
+                            fieldWithPath("lastModifiedOn").type("String").description("Date when account was last modified"),
+                            fieldWithPath("lastModifiedBy").type("String").description("Employee who last modified account")
+                    )));
+  }
+
+  @Test
+  public void documentFetchAccounts ( ) throws Exception {
+
+    Set <String> holdersListOne = new HashSet <>();
+    String holderOne = "Holder One";
+    holdersListOne.add(holderOne);
+
+    Set <String> holdersListTwo = new HashSet <>();
+    String holderTwo = "Holder Two";
+    holdersListTwo.add(holderTwo);
+
+    Set <String> signatoriesOne = new HashSet <>();
+    String signatureOne = "Signatory One";
+    signatoriesOne.add(signatureOne);
+
+    Set <String> signatoriesTwo = new HashSet <>();
+    String signatureTwo = "Signatory Two";
+    signatoriesTwo.add(signatureTwo);
+
+    final Account salesAccountOne = AccountGenerator.createAccount(
+            "Organic Sales", "1111", AccountType.EXPENSE);
+    salesAccountOne.setName("Organic Maize");
+    salesAccountOne.setHolders(holdersListOne);
+    salesAccountOne.setSignatureAuthorities(signatoriesOne);
+    salesAccountOne.setBalance(225.0);
+
+    final Account salesAccountTwo = AccountGenerator.createAccount(
+            "Inorganic Sales", "1112", AccountType.EXPENSE);
+    salesAccountTwo.setName("Organic Beans");
+    salesAccountTwo.setHolders(holdersListTwo);
+    salesAccountTwo.setSignatureAuthorities(signatoriesTwo);
+    salesAccountTwo.setBalance(895.0);
+
+    List <Account> accountList = new ArrayList <>();
+    Stream.of(salesAccountOne, salesAccountTwo).forEach(account -> {
+      accountList.add(account);
+    });
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("11021");
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final AccountPage accountPage =
+            this.testSubject.fetchAccounts(true, null, null, true,
+                    0, 3, null, null);
+    accountPage.setAccounts(accountList);
+    accountPage.setTotalElements(new Long(accountList.size()));
+    accountPage.setTotalPages(1);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/accounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE)
+            .content(gson.toJson(accountPage)))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-accounts", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("accounts[].type").description("AccountType").description("Type of first Account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("accounts[].identifier").type("String").description("first account identifier"),
+                            fieldWithPath("accounts[].name").type("String").description("first account name"),
+                            fieldWithPath("accounts[].holders").type("Set<String>").description("Set of account holders"),
+                            fieldWithPath("accounts[].signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
+                            fieldWithPath("accounts[].balance").type("Double").description("first account's balance"),
+                            fieldWithPath("accounts[].ledger").type("String").description("Associated ledger"),
+                            fieldWithPath("accounts[1].type").description("AccountType").description("Type of second Account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("accounts[1].identifier").type("String").description("second account identifier"),
+                            fieldWithPath("accounts[1].name").type("String").description("second account's name"),
+                            fieldWithPath("accounts[1].holders").type("Set<String>").description("Set of account holders"),
+                            fieldWithPath("accounts[1].signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
+                            fieldWithPath("accounts[1].balance").type("Double").description("second account balance"),
+                            fieldWithPath("accounts[1].ledger").type("String").description("Associated ledger"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    ),
+                    responseFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    )));
+  }
+
+  @Test
+  public void documentFetchAccountsForTerm ( ) throws Exception {
+
+    Set <String> holdersListOne = new HashSet <>();
+    String holderOne = "Holder One";
+    holdersListOne.add(holderOne);
+
+    Set <String> holdersListTwo = new HashSet <>();
+    String holderTwo = "Holder Two";
+    holdersListTwo.add(holderTwo);
+
+    Set <String> signatoriesOne = new HashSet <>();
+    String signatureOne = "Signatory One";
+    signatoriesOne.add(signatureOne);
+
+    Set <String> signatoriesTwo = new HashSet <>();
+    String signatureTwo = "Signatory Two";
+    signatoriesTwo.add(signatureTwo);
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("2100");
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account salesAccountOne = AccountGenerator.createAccount(
+            "Organic Sales", "2100.1", AccountType.REVENUE);
+    salesAccountOne.setName("Organic Maize");
+    salesAccountOne.setHolders(holdersListOne);
+    salesAccountOne.setSignatureAuthorities(signatoriesOne);
+    salesAccountOne.setBalance(225.0);
+
+    final Account salesAccountTwo = AccountGenerator.createAccount(
+            "Inorganic Sales", "100", AccountType.REVENUE);
+    salesAccountTwo.setName("Organic Beans");
+    salesAccountTwo.setHolders(holdersListTwo);
+    salesAccountTwo.setSignatureAuthorities(signatoriesTwo);
+    salesAccountTwo.setBalance(895.0);
+
+    List <Account> accountList = new ArrayList <>();
+    Stream.of(salesAccountOne, salesAccountTwo).forEach(account -> {
+      accountList.add(account);
+    });
+
+    List <Account> accountListForTerm = new ArrayList <>();
+    Stream.of(salesAccountOne, salesAccountTwo).
+            forEach(acc -> {
+              if (acc.getIdentifier().contains(ledger.getIdentifier()))
+                accountListForTerm.add(acc);
+            });
+    Assert.assertTrue(accountListForTerm.size() == 1);
+
+    final AccountPage accountPage =
+            this.testSubject.fetchAccounts(true, ledger.getIdentifier(), null, true,
+                    0, 3, null, null);
+    accountPage.setAccounts(accountListForTerm);
+    accountPage.setTotalElements(new Long(accountListForTerm.size()));
+    accountPage.setTotalPages(1);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/accounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE)
+            .content(gson.toJson(accountPage)))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-accounts-for-term", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("accounts[].type").description("AccountType").description("Type of first Account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("accounts[].identifier").type("String").description("first account identifier"),
+                            fieldWithPath("accounts[].name").type("String").description("first account name"),
+                            fieldWithPath("accounts[].holders").type("Set<String>").description("Set of account holders"),
+                            fieldWithPath("accounts[].signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
+                            fieldWithPath("accounts[].balance").type("Double").description("first account's balance"),
+                            fieldWithPath("accounts[].ledger").type("String").description("Associated ledger"),
+                            fieldWithPath("totalPages").type("Integer").description("Total pages"),
+                            fieldWithPath("totalElements").type("Integer").description("Total accounts in page")
+                    ),
+                    responseFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    )));
+  }
+
+  @Test
+  public void documentFetchActiveAccounts ( ) throws Exception {
+
+    Set <String> holdersListOne = new HashSet <>();
+    String holderOne = "Holder One";
+    holdersListOne.add(holderOne);
+
+    Set <String> holdersListTwo = new HashSet <>();
+    String holderTwo = "Holder Two";
+    holdersListTwo.add(holderTwo);
+
+    Set <String> holdersListThree = new HashSet <>();
+    String holderThree = "Holder Three";
+    holdersListThree.add(holderThree);
+
+    Set <String> holdersListFour = new HashSet <>();
+    String holderFour = "Holder Four";
+    holdersListFour.add(holderFour);
+
+    Set <String> signatoriesOne = new HashSet <>();
+    String signatureOne = "Signatory One";
+    signatoriesOne.add(signatureOne);
+
+    Set <String> signatoriesTwo = new HashSet <>();
+    String signatureTwo = "Signatory Two";
+    signatoriesTwo.add(signatureTwo);
+
+    Set <String> signatoriesThree = new HashSet <>();
+    String signatureThree = "Signatory Three";
+    signatoriesThree.add(signatureThree);
+
+    Set <String> signatoriesFour = new HashSet <>();
+    String signatureFour = "Signatory Four";
+    signatoriesFour.add(signatureFour);
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("3100");
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account salesAccountOne = AccountGenerator.createAccount(
+            "Organic Sales", "3100.10", AccountType.REVENUE);
+    salesAccountOne.setState(Account.State.OPEN.name());
+    salesAccountOne.setName("Organic Maize");
+    salesAccountOne.setHolders(holdersListOne);
+    salesAccountOne.setSignatureAuthorities(signatoriesOne);
+    salesAccountOne.setBalance(225.0);
+    salesAccountOne.setState(Account.State.CLOSED.name());
+
+    final Account salesAccountTwo = AccountGenerator.createAccount(
+            "Inorganic Sales", "3100.20", AccountType.REVENUE);
+    salesAccountTwo.setState(Account.State.OPEN.name());
+    salesAccountTwo.setName("Organic Pens");
+    salesAccountTwo.setHolders(holdersListTwo);
+    salesAccountTwo.setSignatureAuthorities(signatoriesTwo);
+    salesAccountTwo.setBalance(895.0);
+
+    final Account salesAccountThree = AccountGenerator.createAccount(
+            "Organic Sales", "3100.30", AccountType.REVENUE);
+    salesAccountThree.setState(Account.State.OPEN.name());
+    salesAccountThree.setName("Organic Peas");
+    salesAccountThree.setHolders(holdersListThree);
+    salesAccountThree.setSignatureAuthorities(signatoriesThree);
+    salesAccountThree.setBalance(953.0);
+    salesAccountOne.setState(Account.State.CLOSED.name());
+
+    final Account salesAccountFour = AccountGenerator.createAccount(
+            "Inorganic Sales", "3100.40", AccountType.REVENUE);
+    salesAccountFour.setState(Account.State.OPEN.name());
+    salesAccountFour.setName("Organic Pencils");
+    salesAccountFour.setHolders(holdersListFour);
+    salesAccountFour.setSignatureAuthorities(signatoriesFour);
+    salesAccountFour.setBalance(345.0);
+
+    List <Account> accountList = new ArrayList <>();
+    Stream.of(salesAccountOne, salesAccountTwo, salesAccountThree, salesAccountFour).forEach(account -> {
+      accountList.add(account);
+    });
+
+    List <Account> listOfActiveAccounts = new ArrayList <>();
+    Stream.of(salesAccountOne, salesAccountTwo, salesAccountThree, salesAccountFour).
+            forEach(acc -> {
+              if (acc.getState() == Account.State.OPEN.name())
+                listOfActiveAccounts.add(acc);
+            });
+
+    final AccountPage accountPage =
+            this.testSubject.fetchAccounts(true, ledger.getIdentifier(), null, true,
+                    0, 3, null, null);
+    accountPage.setAccounts(listOfActiveAccounts);
+    accountPage.setTotalElements(new Long(listOfActiveAccounts.size()));
+    accountPage.setTotalPages(1);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/accounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE)
+            .content(gson.toJson(accountPage)))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-active-accounts", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("accounts[].type").description("AccountType").description("Type of first Account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("accounts[].identifier").type("String").description("first account identifier"),
+                            fieldWithPath("accounts[].name").type("String").description("first account name"),
+                            fieldWithPath("accounts[].holders").type("Set<String>").description("Set of account holders"),
+                            fieldWithPath("accounts[].signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
+                            fieldWithPath("accounts[].balance").type("Double").description("first account's balance"),
+                            fieldWithPath("accounts[].ledger").type("String").description("Associated ledger"),
+                            fieldWithPath("totalPages").type("Integer").description("Total pages"),
+                            fieldWithPath("totalElements").type("Integer").description("Total accounts in page")
+                    ),
+                    responseFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    )));
+  }
+
+  @Test
+  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")
+                    )));
+  }
+
+  @Test
+  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")
+                    )));
+  }
+
+  @Test
+  public void documentCloseAccount ( ) throws Exception {
+
+    final Ledger randomLedger = LedgerGenerator.createRandomLedger();
+    randomLedger.setIdentifier("3000");
+    this.testSubject.createLedger(randomLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, randomLedger.getIdentifier());
+
+    final Account randomAccount = AccountGenerator.createRandomAccount(randomLedger.getIdentifier());
+    randomAccount.setIdentifier("3001");
+    randomAccount.setState(Account.State.OPEN.name());
+    this.testSubject.createAccount(randomAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, randomAccount.getIdentifier());
+
+    final AccountCommand closeCommand = new AccountCommand();
+    closeCommand.setAction(AccountCommand.Action.CLOSE.name());
+    closeCommand.setComment("Close Account");
+    this.testSubject.accountCommand(randomAccount.getIdentifier(), closeCommand);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/accounts/" + randomAccount.getIdentifier() + "/commands")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(closeCommand)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-close-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("action").description("Action CLOSE " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("comment").description("Close comment"))));
+  }
+
+  @Test
+  public void documentLockAccount ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("4000");
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account rAccount = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    rAccount.setIdentifier("4001");
+    rAccount.setState(Account.State.OPEN.name());
+    this.testSubject.createAccount(rAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, rAccount.getIdentifier());
+
+    final AccountCommand lockCommand = new AccountCommand();
+    lockCommand.setAction(AccountCommand.Action.LOCK.name());
+    lockCommand.setComment("Lock Account");
+    this.testSubject.accountCommand(rAccount.getIdentifier(), lockCommand);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/accounts/" + rAccount.getIdentifier() + "/commands")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(lockCommand)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-lock-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("action").description("Action LOCK " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("comment").description("Lock comment"))));
+  }
+
+  @Test
+  public void documentUnlockAccount ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("5100");
+
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account ulAccount = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    ulAccount.setIdentifier("5001");
+    ulAccount.setState(Account.State.LOCKED.name());
+
+    this.testSubject.createAccount(ulAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, ulAccount.getIdentifier());
+
+    final AccountCommand unlockCommand = new AccountCommand();
+    unlockCommand.setAction(AccountCommand.Action.UNLOCK.name());
+    unlockCommand.setComment("Unlock Account");
+    this.testSubject.accountCommand(ulAccount.getIdentifier(), unlockCommand);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/accounts/" + ulAccount.getIdentifier() + "/commands")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(unlockCommand)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-unlock-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("action").description("Action UNLOCK " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("comment").description("Unlock comment"))));
+  }
+
+  @Test
+  public void documentReopenAccount ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("6000");
+
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account roAccount = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    roAccount.setIdentifier("6001");
+    roAccount.setState(Account.State.CLOSED.name());
+
+    this.testSubject.createAccount(roAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, roAccount.getIdentifier());
+
+    final AccountCommand reopenCommand = new AccountCommand();
+    reopenCommand.setAction(AccountCommand.Action.REOPEN.name());
+    reopenCommand.setComment("Reopen Account");
+    this.testSubject.accountCommand(roAccount.getIdentifier(), reopenCommand);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/accounts/" + roAccount.getIdentifier() + "/commands")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(reopenCommand)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-reopen-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("action").description("Action REOPEN " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("comment").description("Reopen comment"))));
+  }
+
+  @Test
+  public void documentDeleteAccount ( ) throws Exception {
+
+    final Ledger randomLedger = LedgerGenerator.createRandomLedger();
+    randomLedger.setIdentifier("5000");
+    this.testSubject.createLedger(randomLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, randomLedger.getIdentifier());
+
+    final Account randomAccount = AccountGenerator.createRandomAccount(randomLedger.getIdentifier());
+    randomAccount.setIdentifier("5002");
+    this.testSubject.createAccount(randomAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, randomAccount.getIdentifier());
+
+    final AccountCommand closeCommand = new AccountCommand();
+    closeCommand.setAction(AccountCommand.Action.CLOSE.name());
+    closeCommand.setComment("Close Account!");
+    this.testSubject.accountCommand(randomAccount.getIdentifier(), closeCommand);
+    this.eventRecorder.wait(EventConstants.CLOSE_ACCOUNT, randomAccount.getIdentifier());
+
+    this.mockMvc.perform(delete("/accounts/" + randomAccount.getIdentifier())
+            .accept(MediaType.ALL_VALUE)
+            .contentType(MediaType.APPLICATION_JSON_VALUE))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-delete-account", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
+  }
+
+  @Test
+  public void documentFetchActions ( ) throws Exception {
+
+    final Ledger randomLedger = LedgerGenerator.createRandomLedger();
+    randomLedger.setIdentifier("5200");
+    this.testSubject.createLedger(randomLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, randomLedger.getIdentifier());
+
+    final Account randomAccount = AccountGenerator.createRandomAccount(randomLedger.getIdentifier());
+    randomAccount.setIdentifier("5002");
+    randomAccount.setState(Account.State.OPEN.name());
+    this.testSubject.createAccount(randomAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, randomAccount.getIdentifier());
+
+    final List <AccountCommand> accountCommands = super.testSubject.fetchActions(randomAccount.getIdentifier());
+    accountCommands.get(0).setComment("Lock Account");
+    accountCommands.get(0).setCreatedBy("setna");
+    accountCommands.get(0).setCreatedOn(LocalDate.now().toString());
+
+    accountCommands.get(1).setComment("Close Account");
+    accountCommands.get(1).setCreatedBy("setna");
+    accountCommands.get(1).setCreatedOn(LocalDate.now().toString());
+    Assert.assertEquals(2, accountCommands.size());
+
+    this.mockMvc.perform(get("/accounts/" + randomAccount.getIdentifier() + "/actions")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-actions", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("[].action").description("Action LOCK " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("[].comment").description("Reopen comment"),
+                            fieldWithPath("[].createdOn").description("Date when action was carried out"),
+                            fieldWithPath("[].createdBy").description("Employee who acted on account"),
+                            fieldWithPath("[1].action").description("Action CLOSE " +
+                                    " +\n" +
+                                    " *enum* _Action_ { +\n" +
+                                    "    LOCK, +\n" +
+                                    "    UNLOCK, +\n" +
+                                    "    CLOSE, +\n" +
+                                    "    REOPEN +\n" +
+                                    "  }"),
+                            fieldWithPath("[1].comment").description("Reopen comment"),
+                            fieldWithPath("[1].createdOn").description("Date when action was carried out"),
+                            fieldWithPath("[1].createdBy").description("Employee who acted on account"))));
+  }
+
+  @Test
+  public void documentFetchAccountEntries ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("1500");
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    final Account accountToDebit = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    accountToDebit.setIdentifier("1501");
+    this.testSubject.createAccount(accountToDebit);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToDebit.getIdentifier());
+
+    final Account accountToCredit = AccountGenerator.createRandomAccount(ledger.getIdentifier());
+    accountToCredit.setIdentifier("1601");
+    this.testSubject.createAccount(accountToCredit);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToCredit.getIdentifier());
+
+    final int journalEntryCount = 3;
+    final List <JournalEntry> journalEntries = Stream.generate(( ) -> JournalEntryGenerator.createRandomJournalEntry(accountToDebit, "5.0", accountToCredit, "5.0"))
+            .limit(journalEntryCount)
+            .collect(Collectors.toList());
+
+    journalEntries.stream()
+            .forEach(entry -> {
+              entry.setMessage("Message " + journalEntries.indexOf(entry));
+            });
+
+    journalEntries.stream()
+            .map(jEntry -> {
+              this.testSubject.createJournalEntry(jEntry);
+              return jEntry.getTransactionIdentifier();
+            })
+            .forEach(transactionId -> {
+              try {
+                this.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, transactionId);
+                this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, transactionId);
+              } catch (final InterruptedException e) {
+                throw new RuntimeException(e);
+              }
+            });
+
+    Thread.sleep(20L); // Short pause to make sure it really is last.
+
+    final LocalDate today = LocalDate.now(Clock.systemUTC());
+    final String todayDateRange = new DateRange(today, today).toString();
+
+    final AccountEntryPage accountEntriesPage =
+            this.testSubject.fetchAccountEntries(accountToCredit.getIdentifier(), todayDateRange, "Entries Fetched", 0,
+                    1, "ASC", Sort.Direction.ASC.name());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/accounts/" + accountToCredit.getIdentifier() + "/entries")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            /*.content(gson.toJson(accountEntriesPage))*/
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-account-entries", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("accountEntries").type("List<AccountEntry>").description("List of account entries"),
+                            fieldWithPath("accountEntries[].type").description("Type of entry DEBIT or CREDIT "),
+                            fieldWithPath("accountEntries[].transactionDate").description("Date of transaction"),
+                            fieldWithPath("accountEntries[].message").description("Transaction message"),
+                            fieldWithPath("accountEntries[].amount").description("Transaction amount"),
+                            fieldWithPath("accountEntries[].balance").description("Transaction balance"),
+                            fieldWithPath("accountEntries[1].type").description("Type of entry DEBIT or CREDIT "),
+                            fieldWithPath("accountEntries[1].transactionDate").description("Date of transaction"),
+                            fieldWithPath("accountEntries[1].message").description("Transaction message"),
+                            fieldWithPath("accountEntries[1].amount").description("Transaction amount"),
+                            fieldWithPath("accountEntries[1].balance").description("Transaction balance"),
+                            fieldWithPath("accountEntries[2].type").description("Type of entry DEBIT or CREDIT "),
+                            fieldWithPath("accountEntries[2].transactionDate").description("Date of transaction"),
+                            fieldWithPath("accountEntries[2].message").description("Transaction message"),
+                            fieldWithPath("accountEntries[2].amount").description("Transaction amount"),
+                            fieldWithPath("accountEntries[2].balance").description("Transaction balance"),
+                            fieldWithPath("totalPages").type("List<AccountEntry>").description("Reopen comment"),
+                            fieldWithPath("totalElements").type("List<AccountEntry>").description("Reopen comment"))));
+  }
+}
\ No newline at end of file
diff --git a/component-test/src/main/java/org/apache/fineract/cn/accounting/JournalEntryApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/accounting/JournalEntryApiDocumentation.java
new file mode 100644
index 0000000..5cfbd09
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/accounting/JournalEntryApiDocumentation.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import com.google.gson.Gson;
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.*;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.apache.fineract.cn.lang.DateConverter;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.math.BigDecimal;
+import java.text.MessageFormat;
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class JournalEntryApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("build/doc/generated-snippets/test-journal-entry");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentCreateJournalEntry ( ) throws Exception {
+
+    final Ledger assetLedger = LedgerGenerator.createRandomLedger();
+    assetLedger.setType(AccountType.ASSET.name());
+    this.testSubject.createLedger(assetLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, assetLedger.getIdentifier());
+
+    final Account debtorAccount = AccountGenerator.createRandomAccount(assetLedger.getIdentifier());
+    debtorAccount.setIdentifier("7100");
+    debtorAccount.setType(AccountType.ASSET.name());
+    debtorAccount.setBalance(100.00D);
+    this.testSubject.createAccount(debtorAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, debtorAccount.getIdentifier());
+
+    final Ledger liabilityLedger = LedgerGenerator.createRandomLedger();
+    liabilityLedger.setIdentifier("8120");
+    liabilityLedger.setType(AccountType.LIABILITY.name());
+    this.testSubject.createLedger(liabilityLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, liabilityLedger.getIdentifier());
+
+    final Account creditorAccount = AccountGenerator.createRandomAccount(liabilityLedger.getIdentifier());
+    creditorAccount.setType(AccountType.LIABILITY.name());
+    creditorAccount.setBalance(100.00D);
+    this.testSubject.createAccount(creditorAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, creditorAccount.getIdentifier());
+
+    final JournalEntry journalEntry = JournalEntryGenerator.createRandomJournalEntry(debtorAccount, "50.00",
+            creditorAccount, "50.00");
+    journalEntry.setTransactionIdentifier("F14062018");
+    journalEntry.setTransactionDate(LocalDate.now().toString());
+    journalEntry.setTransactionType("ADBT");
+    journalEntry.setClerk("Boring Clerk");
+    journalEntry.setNote("Account Db");
+    journalEntry.setMessage("Account Has Been Debited");
+
+    Set <Debtor> debtorSet = new HashSet <>();
+    debtorSet.add(new Debtor(debtorAccount.getIdentifier(), debtorAccount.getBalance().toString()));
+
+    Set <Creditor> creditorSet = new HashSet <>();
+    creditorSet.add(new Creditor(creditorAccount.getIdentifier(), creditorAccount.getBalance().toString()));
+
+    journalEntry.setDebtors(debtorSet);
+    journalEntry.setCreditors(creditorSet);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/journal")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(journalEntry)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-create-journal-entry", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("transactionIdentifier").description("Transaction ID"),
+                            fieldWithPath("transactionDate").description("Account identifier"),
+                            fieldWithPath("transactionType").description("Type of transaction"),
+                            fieldWithPath("clerk").type("String").description("Clerk who initiated transaction"),
+                            fieldWithPath("note").type("String").description("Transaction note"),
+                            fieldWithPath("debtors").type("Set<Debtors>").description("Set of debtors"),
+                            fieldWithPath("creditors").type("Set<Creditors>").description("Set of creditors"),
+                            fieldWithPath("message").description("Associated ledger")
+                    )));
+  }
+
+  @Test
+  public void documentFetchJournalEntries ( ) throws Exception {
+
+    final Ledger assetLedgerOne = LedgerGenerator.createRandomLedger();
+    assetLedgerOne.setIdentifier("7120");
+    assetLedgerOne.setType(AccountType.ASSET.name());
+    this.testSubject.createLedger(assetLedgerOne);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, assetLedgerOne.getIdentifier());
+
+    final Account accountToDebitOne = AccountGenerator.createRandomAccount(assetLedgerOne.getIdentifier());
+    accountToDebitOne.setIdentifier("7140");
+    accountToDebitOne.setType(AccountType.ASSET.name());
+    accountToDebitOne.setBalance(1000.0);
+    this.testSubject.createAccount(accountToDebitOne);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToDebitOne.getIdentifier());
+
+    final Ledger liabilityLedgerOne = LedgerGenerator.createRandomLedger();
+    liabilityLedgerOne.setIdentifier("8150");
+    liabilityLedgerOne.setType(AccountType.LIABILITY.name());
+    this.testSubject.createLedger(liabilityLedgerOne);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, liabilityLedgerOne.getIdentifier());
+
+    final Account accountToCreditOne = AccountGenerator.createRandomAccount(liabilityLedgerOne.getIdentifier());
+    accountToCreditOne.setIdentifier("8160");
+    accountToCreditOne.setType(AccountType.LIABILITY.name());
+    this.testSubject.createAccount(accountToCreditOne);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToCreditOne.getIdentifier());
+
+    final JournalEntry journalEntryOne = JournalEntryGenerator.createRandomJournalEntry(accountToDebitOne, "50.00",
+            accountToCreditOne, "50.00");
+    final OffsetDateTime startOne = OffsetDateTime.of(2017, 6, 20, 1, 0, 0, 0, ZoneOffset.UTC);
+    journalEntryOne.setTransactionDate(startOne.format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
+    journalEntryOne.setTransactionIdentifier("FE1");
+    journalEntryOne.setTransactionType("ACCT");
+    journalEntryOne.setClerk("Mr. " + journalEntryOne.getClerk().toUpperCase().charAt(0) + journalEntryOne.getClerk().substring(1, 5));
+    journalEntryOne.setNote("Noted Transfer");
+    journalEntryOne.setMessage("First Message Noted");
+
+    this.testSubject.createJournalEntry(journalEntryOne);
+    this.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, journalEntryOne.getTransactionIdentifier());
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, journalEntryOne.getTransactionIdentifier());
+
+    final Ledger assetLedgerTwo = LedgerGenerator.createRandomLedger();
+    assetLedgerTwo.setIdentifier("7200");
+    assetLedgerTwo.setType(AccountType.ASSET.name());
+    this.testSubject.createLedger(assetLedgerTwo);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, assetLedgerTwo.getIdentifier());
+
+    final Account accountToDebitTwo = AccountGenerator.createRandomAccount(assetLedgerTwo.getIdentifier());
+    accountToDebitTwo.setIdentifier("7210");
+    accountToDebitTwo.setType(AccountType.ASSET.name());
+    accountToDebitTwo.setBalance(2000.0);
+    this.testSubject.createAccount(accountToDebitTwo);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToDebitTwo.getIdentifier());
+
+    final Ledger liabilityLedgerTwo = LedgerGenerator.createRandomLedger();
+    liabilityLedgerTwo.setIdentifier("8200");
+    liabilityLedgerTwo.setType(AccountType.LIABILITY.name());
+    this.testSubject.createLedger(liabilityLedgerTwo);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, liabilityLedgerTwo.getIdentifier());
+
+    final Account accountToCreditTwo = AccountGenerator.createRandomAccount(liabilityLedgerTwo.getIdentifier());
+    accountToCreditTwo.setIdentifier("8210");
+    accountToCreditTwo.setType(AccountType.LIABILITY.name());
+    this.testSubject.createAccount(accountToCreditTwo);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToCreditTwo.getIdentifier());
+
+    final JournalEntry journalEntryTwo = JournalEntryGenerator.createRandomJournalEntry(accountToDebitTwo, "40.00",
+            accountToCreditTwo, "40.00");
+    final OffsetDateTime startTwo = OffsetDateTime.of(2017, 6, 24, 1, 0, 0, 0, ZoneOffset.UTC);
+    journalEntryTwo.setTransactionDate(startTwo.format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
+    journalEntryTwo.setTransactionIdentifier("FE2");
+    journalEntryTwo.setTransactionType("ACRT");
+    journalEntryTwo.setClerk("Mrs. " + journalEntryTwo.getClerk().toUpperCase().charAt(0) + journalEntryTwo.getClerk().substring(1, 5));
+    journalEntryTwo.setNote("Noted Credit");
+    journalEntryTwo.setMessage("Message Noted");
+
+    this.testSubject.createJournalEntry(journalEntryTwo);
+    this.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, journalEntryTwo.getTransactionIdentifier());
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, journalEntryTwo.getTransactionIdentifier());
+
+    final LocalDate beginDate = LocalDate.of(2017, 6, 20);
+    final LocalDate endDate = LocalDate.of(2017, 6, 24);
+    final String dateRange = MessageFormat.format("{0}..{1}",
+            DateConverter.toIsoString(beginDate),
+            DateConverter.toIsoString(endDate));
+
+    final List <JournalEntry> journalEntriesPage =
+            this.testSubject.fetchJournalEntries(dateRange, accountToDebitOne.getIdentifier(), BigDecimal.valueOf(50.00D));
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/journal")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-journal-entries", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
+  }
+
+  @Test
+  public void documentFindJournalEntry ( ) throws Exception {
+
+    final Ledger assetLedger = LedgerGenerator.createRandomLedger();
+    assetLedger.setIdentifier("7100");
+    assetLedger.setType(AccountType.ASSET.name());
+    this.testSubject.createLedger(assetLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, assetLedger.getIdentifier());
+
+    final Account accountToDebit = AccountGenerator.createRandomAccount(assetLedger.getIdentifier());
+    accountToDebit.setIdentifier("7110");
+    accountToDebit.setType(AccountType.ASSET.name());
+    accountToDebit.setBalance(1000.0);
+    this.testSubject.createAccount(accountToDebit);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToDebit.getIdentifier());
+
+    final Ledger liabilityLedger = LedgerGenerator.createRandomLedger();
+    liabilityLedger.setIdentifier("8100");
+    liabilityLedger.setType(AccountType.LIABILITY.name());
+    this.testSubject.createLedger(liabilityLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, liabilityLedger.getIdentifier());
+
+    final Account accountToCredit = AccountGenerator.createRandomAccount(liabilityLedger.getIdentifier());
+    accountToCredit.setIdentifier("8110");
+    accountToCredit.setType(AccountType.LIABILITY.name());
+    this.testSubject.createAccount(accountToCredit);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, accountToCredit.getIdentifier());
+
+    final JournalEntry journalEntry = JournalEntryGenerator.createRandomJournalEntry(accountToDebit, "50.00",
+            accountToCredit, "50.00");
+    final OffsetDateTime start = OffsetDateTime.of(2017, 6, 24, 1, 0, 0, 0, ZoneOffset.UTC);
+    journalEntry.setTransactionDate(start.format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
+    journalEntry.setTransactionIdentifier("FE136183");
+    journalEntry.setTransactionType("ACCO");
+    journalEntry.setClerk("Mr. " + journalEntry.getClerk().toUpperCase().charAt(0) + journalEntry.getClerk().substring(1, 5));
+    journalEntry.setNote("Noted");
+    journalEntry.setMessage("Message Noted");
+
+    this.testSubject.createJournalEntry(journalEntry);
+    this.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, journalEntry.getTransactionIdentifier());
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, journalEntry.getTransactionIdentifier());
+
+    this.mockMvc.perform(get("/journal/" + journalEntry.getTransactionIdentifier())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-find-journal-entry", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("transactionIdentifier").description("Transaction ID"),
+                            fieldWithPath("transactionDate").description("Account identifier"),
+                            fieldWithPath("transactionType").description("Type of transaction"),
+                            fieldWithPath("clerk").type("String").description("Clerk who initiated transaction"),
+                            fieldWithPath("note").type("String").description("Transaction note"),
+                            fieldWithPath("debtors").type("Set<Debtors>").description("Set of debtors"),
+                            fieldWithPath("creditors").type("Set<Creditors>").description("Set of creditors"),
+                            fieldWithPath("state").type("State").description("State of journal entry " +
+                                    " + \n" +
+                                    " *enum* _State_ { + \n" +
+                                    "    PENDING, + \n" +
+                                    "    PROCESSED + \n" +
+                                    "  } +"),
+                            fieldWithPath("message").description("Journal Message  ")
+                    )));
+  }
+}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
new file mode 100644
index 0000000..f1748c1
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
@@ -0,0 +1,440 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import com.google.gson.Gson;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.*;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class LedgerApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("build/doc/generated-snippets/test-ledger");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentCreateLedger ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+
+    ledger.setType(AccountType.ASSET.name());
+    ledger.setIdentifier("1000");
+    ledger.setName("Cash");
+    ledger.setDescription("Cash Ledger");
+    ledger.setShowAccountsInChart(Boolean.TRUE);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/ledgers")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(ledger)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-create-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("Account identifier"),
+                            fieldWithPath("name").description("Name of account"),
+                            fieldWithPath("description").description("Description of account"),
+                            fieldWithPath("showAccountsInChart").type("Boolean").description("Should account be shown in charts ?")
+                    )));
+  }
+
+  @Test
+  public void documentFetchLedgers ( ) throws Exception {
+
+    final Ledger ledgerOne = LedgerGenerator.createRandomLedger();
+    ledgerOne.setIdentifier("1021");
+    ledgerOne.setName("Name of " + ledgerOne.getIdentifier());
+    ledgerOne.setDescription("Description of " + ledgerOne.getIdentifier());
+    ledgerOne.setShowAccountsInChart(Boolean.TRUE);
+
+    final Ledger ledgerTwo = LedgerGenerator.createRandomLedger();
+    ledgerTwo.setIdentifier("1022");
+    ledgerTwo.setName("Name of " + ledgerTwo.getIdentifier());
+    ledgerTwo.setDescription("Description of " + ledgerTwo.getIdentifier());
+    ledgerTwo.setShowAccountsInChart(Boolean.FALSE);
+
+    final Ledger ledgerThree = LedgerGenerator.createRandomLedger();
+    ledgerThree.setIdentifier("1023");
+    ledgerThree.setName("Name of " + ledgerThree.getIdentifier());
+    ledgerThree.setDescription("Description of " + ledgerThree.getIdentifier());
+    ledgerThree.setShowAccountsInChart(Boolean.TRUE);
+
+    List <Ledger> ledgerList = new ArrayList <>();
+    Stream.of(ledgerOne, ledgerTwo, ledgerThree).forEach(ledger -> {
+      ledgerList.add(ledger);
+    });
+
+    ledgerList.stream()
+            .forEach(ledger -> {
+              this.testSubject.createLedger(ledger);
+              try {
+                this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+              } catch (InterruptedException e) {
+                e.printStackTrace();
+              }
+            });
+
+    this.mockMvc.perform(get("/ledgers")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-ledgers", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("ledgers").type("List<Ledger>").description("List of Ledgers"),
+                            fieldWithPath("ledgers[].type").description("AccountType").description("Type of first ledger " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("ledgers[].identifier").type("String").description("first ledger identifier"),
+                            fieldWithPath("ledgers[].name").type("String").description("first ledger name"),
+                            fieldWithPath("ledgers[].description").type("String").description("description of first ledger"),
+                            fieldWithPath("ledgers[].parentLedgerIdentifier").description("first ledger's parent "),
+                            fieldWithPath("ledgers[].totalValue").type("String").description("Total Value of first ledger"),
+                            fieldWithPath("ledgers[].createdOn").type("String").description("date first ledger was created"),
+                            fieldWithPath("ledgers[].createdBy").type("String").description("employee who created first ledger"),
+                            fieldWithPath("ledgers[].lastModifiedOn").type("String").description("date first ledger was modified"),
+                            fieldWithPath("ledgers[].lastModifiedBy").type("String").description("employee who last modified first ledger"),
+                            fieldWithPath("ledgers[].showAccountsInChart").type("Boolean").description("Should ledger be shown in charts ?"),
+                            fieldWithPath("ledgers[1].type").description("AccountType").description("Type of second ledger " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("ledgers[1].identifier").type("String").description("second ledger identifier"),
+                            fieldWithPath("ledgers[1].name").type("String").description("second ledger name"),
+                            fieldWithPath("ledgers[1].description").type("String").description("description of second ledger"),
+                            fieldWithPath("ledgers[1].parentLedgerIdentifier").description("second ledger's parent "),
+                            fieldWithPath("ledgers[1].totalValue").type("String").description("Total Value of second ledger"),
+                            fieldWithPath("ledgers[1].createdOn").type("String").description("date second ledger was created"),
+                            fieldWithPath("ledgers[1].createdBy").type("String").description("employee who created second ledger"),
+                            fieldWithPath("ledgers[1].lastModifiedOn").type("String").description("date second ledger was modified"),
+                            fieldWithPath("ledgers[1].lastModifiedBy").type("String").description("employee who last modified second ledger"),
+                            fieldWithPath("ledgers[1].showAccountsInChart").type("Boolean").description("Should ledger be shown in charts ?"),
+                            fieldWithPath("ledgers[2].type").description("AccountType").description("Type of third ledger " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("ledgers[2].identifier").type("String").description("third ledger identifier"),
+                            fieldWithPath("ledgers[2].name").type("String").description("third ledger name"),
+                            fieldWithPath("ledgers[2].description").type("String").description("description of third ledger"),
+                            fieldWithPath("ledgers[2].parentLedgerIdentifier").description("third ledger's parent "),
+                            fieldWithPath("ledgers[2].totalValue").type("String").description("Total Value of third ledger"),
+                            fieldWithPath("ledgers[2].createdOn").type("String").description("date third ledger was created"),
+                            fieldWithPath("ledgers[2].createdBy").type("String").description("employee who created third ledger"),
+                            fieldWithPath("ledgers[2].lastModifiedOn").type("String").description("date second ledger was modified"),
+                            fieldWithPath("ledgers[2].lastModifiedBy").type("String").description("employee who last modified third ledger"),
+                            fieldWithPath("ledgers[2].showAccountsInChart").type("Boolean").description("Should ledger be shown in charts ?"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    )));
+  }
+
+  @Test
+  public void documentFindLedger ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("7200");
+    ledger.setName("Name of" + ledger.getIdentifier());
+    ledger.setDescription("Description of " + ledger.getIdentifier());
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/ledgers/" + ledger.getIdentifier())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-find-ledger", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("type").description("AccountType").description("Type of first ledger " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("identifier").type("String").description("first ledger identifier"),
+                            fieldWithPath("name").type("String").description("first ledger name"),
+                            fieldWithPath("description").type("String").description("description of first ledger"),
+                            fieldWithPath("subLedgers").type("List<Ledger>").description("list of sub ledgers"),
+                            fieldWithPath(".parentLedgerIdentifier").description("first ledger's parent "),
+                            fieldWithPath("totalValue").type("String").description("Total Value of first ledger"),
+                            fieldWithPath("createdOn").type("String").description("date first ledger was created"),
+                            fieldWithPath("createdBy").type("String").description("employee who created first ledger"),
+                            fieldWithPath("lastModifiedOn").type("String").description("date first ledger was modified"),
+                            fieldWithPath("lastModifiedBy").type("String").description("employee who last modified first ledger"),
+                            fieldWithPath("showAccountsInChart").type("Boolean").description("Should ledger be shown in charts ?")
+                    )));
+  }
+
+  @Test
+  public void documentAddSubLedger ( ) throws Exception {
+
+    final Ledger parentLedger = LedgerGenerator.createRandomLedger();
+    parentLedger.setIdentifier("6200");
+    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("6201");
+    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 ?")
+                    )));
+  }
+
+  @Test
+  public void documentModifyLedger ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("6210");
+    ledger.setName("Old Name Of" + ledger.getIdentifier());
+    ledger.setDescription("Old Description Of " + ledger.getIdentifier());
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    ledger.setName("New Name Of " + ledger.getIdentifier());
+    ledger.setDescription("New Description Of " + ledger.getIdentifier());
+    ledger.setShowAccountsInChart(Boolean.TRUE);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(put("/ledgers/" + ledger.getIdentifier())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(ledger)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-modify-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 ?")
+                    )));
+  }
+
+  @Test
+  public void documentDeleteLedger ( ) throws Exception {
+
+    final Ledger ledger = LedgerGenerator.createRandomLedger();
+    ledger.setIdentifier("6200");
+    ledger.setName("Old Name Of" + ledger.getIdentifier());
+    ledger.setDescription("Old Description Of " + ledger.getIdentifier());
+    this.testSubject.createLedger(ledger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, ledger.getIdentifier());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(delete("/ledgers/" + ledger.getIdentifier())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-delete-ledger", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
+  }
+
+  @Test
+  public void documentFetchAccountsForLedger ( ) throws Exception {
+
+    Set <String> holdersListOne = new HashSet <>();
+    String holderOne = "Holder One";
+    holdersListOne.add(holderOne);
+
+    Set <String> signatoriesOne = new HashSet <>();
+    String signatureOne = "Signatory One";
+    signatoriesOne.add(signatureOne);
+
+    final Ledger liabilityLedger = LedgerGenerator.createRandomLedger();
+    liabilityLedger.setType(AccountType.LIABILITY.name());
+    liabilityLedger.setIdentifier("6100");
+    this.testSubject.createLedger(liabilityLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, liabilityLedger.getIdentifier());
+
+    final List <Account> createdLiabilityAccounts = Stream.generate(( ) -> AccountGenerator.createRandomAccount(liabilityLedger.getIdentifier())).limit(1)
+            .peek(account -> {
+              account.setType(AccountType.LIABILITY.name());
+              account.setIdentifier("6100.10");
+              account.setName("First Account Of " + liabilityLedger.getIdentifier());
+              account.setHolders(holdersListOne);
+              account.setSignatureAuthorities(signatoriesOne);
+              account.setBalance(1234.0);
+              account.setLedger(liabilityLedger.getIdentifier());
+              this.testSubject.createAccount(account);
+            })
+            .collect(Collectors.toList());
+
+    createdLiabilityAccounts.stream().forEach(
+            account -> {
+              try {
+                this.eventRecorder.wait(EventConstants.POST_ACCOUNT, account.getIdentifier());
+              } catch (InterruptedException e) {
+                e.printStackTrace();
+              }
+            });
+
+    final AccountPage accountPage =
+            this.testSubject.fetchAccounts(true, liabilityLedger.getIdentifier(), null, true,
+                    0, createdLiabilityAccounts.size(), null, null);
+    accountPage.setAccounts(createdLiabilityAccounts);
+    accountPage.setTotalElements(new Long(createdLiabilityAccounts.size()));
+    accountPage.setTotalPages(1);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/ledgers/" + liabilityLedger.getIdentifier() + "/accounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE)
+            .content(gson.toJson(accountPage)))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-accounts-for-ledger", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("accounts[].type").description("AccountType").description("Type of first Account " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _AccountType_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  REVENUE, + \n" +
+                                    "  EXPENSE + \n" +
+                                    "}"),
+                            fieldWithPath("accounts[].identifier").type("String").description("first account identifier"),
+                            fieldWithPath("accounts[].name").type("String").description("first account name"),
+                            fieldWithPath("accounts[].holders").type("Set<String>").description("Set of account holders"),
+                            fieldWithPath("accounts[].signatureAuthorities").type("Set<String>").description("Set of signatories to account"),
+                            fieldWithPath("accounts[].balance").type("Double").description("first account's balance"),
+                            fieldWithPath("accounts[].ledger").type("String").description("Associated ledger"),
+                            fieldWithPath("totalPages").type("Integer").description("Total pages"),
+                            fieldWithPath("totalElements").type("Integer").description("Total accounts in page")
+                    ),
+                    responseFields(
+                            fieldWithPath("accounts").type("List<Account>").description("List of Accounts"),
+                            fieldWithPath("totalPages").type("Integer").description("Total number of pages"),
+                            fieldWithPath("totalElements").type("String").description("Total number of elements")
+                    )));
+  }
+}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/accounting/TransactionTypeApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/accounting/TransactionTypeApiDocumentation.java
new file mode 100644
index 0000000..c9a1666
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/accounting/TransactionTypeApiDocumentation.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import com.google.gson.Gson;
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.*;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.apache.fineract.cn.accounting.util.TransactionTypeGenerator;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TransactionTypeApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("build/doc/generated-snippets/test-transaction-type");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentCreateTransactionType ( ) throws Exception {
+
+    final TransactionType transactionType = TransactionTypeGenerator.createRandomTransactionType();
+    transactionType.setCode("ABCD");
+    transactionType.setName("Account Starter");
+    transactionType.setDescription("Account Starter");
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/transactiontypes")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(transactionType)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-create-transaction-type", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("code").description("Transaction Type's code"),
+                            fieldWithPath("name").description("Name of transaction type"),
+                            fieldWithPath("description").description("Description of transaction type")
+                    )));
+  }
+
+  @Test
+  public void documentFindTransactionType ( ) throws Exception {
+
+    final TransactionType transactionType = TransactionTypeGenerator.createRandomTransactionType();
+    transactionType.setCode("AXYZ");
+    transactionType.setName("Account Lock");
+    transactionType.setDescription("Lock Account");
+    this.testSubject.createTransactionType(transactionType);
+    this.eventRecorder.wait(EventConstants.POST_TX_TYPE, transactionType.getCode());
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(get("/transactiontypes/" + transactionType.getCode())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(transactionType)))
+            .andExpect(status().isOk())
+            .andDo(document("document-find-transaction-type", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("code").description("Transaction Type's code"),
+                            fieldWithPath("name").description("Name of transaction type"),
+                            fieldWithPath("description").description("Description of transaction type")
+                    )));
+
+  }
+
+  @Test
+  public void documentFetchTransactionType ( ) throws Exception {
+
+    final TransactionTypePage transactionTypePage =
+            super.testSubject.fetchTransactionTypes(null, 0, 10, "code", Sort.Direction.DESC.name());
+
+    this.mockMvc.perform(get("/transactiontypes")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-transaction-type", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
+  }
+
+  @Test
+  public void documentChangeTransactionType ( ) throws Exception {
+
+    final TransactionType transactionType = TransactionTypeGenerator.createRandomTransactionType();
+    transactionType.setCode("AZYX");
+    transactionType.setName("Account Locked");
+    transactionType.setDescription("Locked Account");
+    this.testSubject.createTransactionType(transactionType);
+    this.eventRecorder.wait(EventConstants.POST_TX_TYPE, transactionType.getCode());
+
+    transactionType.setName("Account UnveilOne");
+    transactionType.setDescription("Unveiled Account");
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(put("/transactiontypes/" + transactionType.getCode())
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(transactionType)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-change-transaction-type", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("code").description("Transaction Type's code"),
+                            fieldWithPath("name").description("Name of transaction type"),
+                            fieldWithPath("description").description("Description of transaction type")
+                    )));
+  }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services