in component-test/src/main/java/org/apache/fineract/cn/teller/TellerApiDocumentation.java [216:319]
public void documentFetchTellers ( ) throws Exception {
final String officeIdentifier = "office247";
final Teller tellerOne = TellerGenerator.createRandomTeller();
final Teller tellerTwo = TellerGenerator.createRandomTeller();
List <Teller> tellers = Lists.newArrayList(tellerOne, tellerTwo);
tellerOne.setCode("412389");
tellerOne.setPassword(RandomStringUtils.randomAlphabetic(9));
tellerOne.setTellerAccountIdentifier("TEL412389C");
tellerOne.setVaultAccountIdentifier("TEL412389C");
tellerOne.setChequesReceivableAccount("CHA2018ABC");
tellerOne.setCashOverShortAccount("CHA2018ABC");
tellerOne.setAssignedEmployee("Chi Ndi");
tellerOne.setCashdrawLimit(new BigDecimal("4000000"));
tellerOne.setDenominationRequired(Boolean.FALSE);
tellerTwo.setCode("512389");
tellerTwo.setPassword(RandomStringUtils.randomAlphabetic(9));
tellerTwo.setTellerAccountIdentifier("TEL512389D");
tellerTwo.setVaultAccountIdentifier("TEL512389D");
tellerTwo.setChequesReceivableAccount("DHA2018ABD");
tellerTwo.setCashOverShortAccount("DHA2018ABD");
tellerTwo.setAssignedEmployee("Chia Chenjo");
tellerTwo.setCashdrawLimit(new BigDecimal("5000000"));
tellerTwo.setDenominationRequired(Boolean.FALSE);
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
tellers.stream().forEach(tell -> {
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(this.accountingService).findAccount(Matchers.eq(tell.getTellerAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(this.accountingService).findAccount(Matchers.eq(tell.getVaultAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(this.accountingService).findAccount(Matchers.eq(tell.getChequesReceivableAccount()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(this.accountingService).findAccount(Matchers.eq(tell.getCashOverShortAccount()));
super.testSubject.create(officeIdentifier, tell);
try {
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, tell.getCode()));
} catch (final InterruptedException e) {
throw new IllegalStateException(e);
}
});
this.mockMvc.perform(get("/offices/" + officeIdentifier + "/teller/")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.ALL_VALUE))
.andExpect(status().isOk())
.andDo(document("document-fetch-tellers", preprocessResponse(prettyPrint()),
responseFields(
fieldWithPath("[].code").description("Code for first teller "),
fieldWithPath("[].password").type("String").description("first teller's Password"),
fieldWithPath("[].cashdrawLimit").type("BigDecimal").description("first teller's Cash Withdrawal Limit"),
fieldWithPath("[].tellerAccountIdentifier").description("first Teller Account Identifier"),
fieldWithPath("[].vaultAccountIdentifier").description("first teller Vault Account Identifier"),
fieldWithPath("[].chequesReceivableAccount").description("Cheques Receivable Account"),
fieldWithPath("[].cashOverShortAccount").description("Cash Over Short Account"),
fieldWithPath("[].denominationRequired").description("first teller's Denomination Required"),
fieldWithPath("[].assignedEmployee").description("first teller's Assigned Employee"),
fieldWithPath("[].state").description(" State of first Teller " +
" + \n" +
" *enum* _State_ { + \n" +
" ACTIVE, + \n" +
" CLOSED, + \n" +
" OPEN, + \n" +
" PAUSED + \n" +
" }"),
fieldWithPath("[].createdBy").description("Employee who created teller"),
fieldWithPath("[].createdOn").description("Date employee was created"),
fieldWithPath("[].lastModifiedBy").type("String").description("Employee who last modified teller"),
fieldWithPath("[].lastModifiedOn").type("String").description("Date when teller was last modified"),
fieldWithPath("[].lastOpenedBy").type("String").description("Last employee who opened teller"),
fieldWithPath("[].lastOpenedOn").type("String").description("Last time teller was opened"),
fieldWithPath("[1].code").description("Second teller's Code"),
fieldWithPath("[1].password").type("String").description("Second teller's Password"),
fieldWithPath("[1].cashdrawLimit").type("BigDecimal").description("Cash Withdrawal Limit"),
fieldWithPath("[1].tellerAccountIdentifier").description("Second Teller's Account Identifier"),
fieldWithPath("[1].vaultAccountIdentifier").description("Vault Account Identifier"),
fieldWithPath("[1].chequesReceivableAccount").description("Cheques Receivable Account"),
fieldWithPath("[1].cashOverShortAccount").description("Cash Over Short Account"),
fieldWithPath("[1].denominationRequired").description("Denomination Required"),
fieldWithPath("[1].assignedEmployee").description("second teller's Assigned Employee"),
fieldWithPath("[1].state").description(" State of second Teller " +
" + \n" +
" *enum* _State_ { + \n" +
" ACTIVE, + \n" +
" CLOSED, + \n" +
" OPEN, + \n" +
" PAUSED + \n" +
" }"),
fieldWithPath("[1].createdBy").description("Employee who created teller"),
fieldWithPath("[1].createdOn").description("Date employee was created"),
fieldWithPath("[1].lastModifiedBy").type("String").description("Employee who last modified teller"),
fieldWithPath("[1].lastModifiedOn").type("String").description("Date when teller was last modified"),
fieldWithPath("[1].lastOpenedBy").type("String").description("Last employee who opened teller"),
fieldWithPath("[1].lastOpenedOn").type("String").description("Last time teller was opened")
)));
}