in component-test/src/main/java/org/apache/fineract/cn/teller/TellerApiDocumentation.java [376:427]
public void documentOpenTeller ( ) throws Exception {
final String officeIdentifier = "moritavo";
final Teller teller = TellerGenerator.createRandomTeller();
teller.setCode("689");
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).officeExists(Matchers.eq(officeIdentifier));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getTellerAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getVaultAccountIdentifier()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getChequesReceivableAccount()));
Mockito.doAnswer(invocation -> Optional.of(new Account()))
.when(super.accountingServiceSpy).findAccount(Matchers.eq(teller.getCashOverShortAccount()));
super.testSubject.create(officeIdentifier, teller);
super.eventRecorder.wait(EventConstants.POST_TELLER, teller.getCode());
final TellerManagementCommand open = new TellerManagementCommand();
open.setAction(TellerManagementCommand.Action.OPEN.name());
open.setAdjustment(TellerManagementCommand.Adjustment.NONE.name());
open.setAssignedEmployeeIdentifier("Ashu");
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).employeeExists(Matchers.eq(open.getAssignedEmployeeIdentifier()));
Gson gson = new Gson();
this.mockMvc.perform(post("/offices/" + officeIdentifier + "/teller/" + teller.getCode() + "/commands")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(gson.toJson(open))
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isAccepted())
.andDo(document("document-open-teller", preprocessRequest(prettyPrint()),
requestFields(
fieldWithPath("action").description("Action " +
" + \n " +
" *enum* _Action_ { + \n" +
" OPEN, + \n" +
" CLOSE + \n" +
" }"),
fieldWithPath("adjustment").description("Adjustment " +
"*enum* _Adjustment_ { + \n" +
" NONE, + \n" +
" DEBIT, + \n" +
" CREDIT + \n" +
" } + \n" +
""),
fieldWithPath("assignedEmployeeIdentifier").type("String").optional().description("Teller Account Identifier")
)));
}