in component-test/src/main/java/org/apache/fineract/cn/teller/TellerApiDocumentation.java [430:490]
public void documentCloseTeller ( ) throws Exception {
final String officeIdentifier = "antananarivo";
final Teller teller = TellerGenerator.createRandomTeller();
teller.setCode("7239");
teller.setState(Teller.State.OPEN.name());
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 close = new TellerManagementCommand();
close.setAction(TellerManagementCommand.Action.CLOSE.name());
close.setAdjustment(TellerManagementCommand.Adjustment.NONE.name());
close.setAssignedEmployeeIdentifier("Antah");
final TellerManagementCommand open = new TellerManagementCommand();
open.setAction(TellerManagementCommand.Action.OPEN.name());
open.setAdjustment(TellerManagementCommand.Adjustment.NONE.name());
open.setAssignedEmployeeIdentifier("Antah");
Mockito.doAnswer(invocation -> true)
.when(super.organizationServiceSpy).employeeExists(Matchers.eq(close.getAssignedEmployeeIdentifier()));
super.testSubject.post(officeIdentifier, teller.getCode(), open);
Assert.assertTrue(super.eventRecorder.wait(EventConstants.OPEN_TELLER, teller.getCode()));
Gson gson = new Gson();
this.mockMvc.perform(post("/offices/" + officeIdentifier + "/teller/" + teller.getCode() + "/commands")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(gson.toJson(close))
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isAccepted())
.andDo(document("document-close-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")
)));
}