in component-test/src/main/java/org/apache/fineract/cn/deposit/DepositApiDocumentation.java [607:628]
public void documentCloseInstance ( ) throws Exception {
final ProductDefinition productDefinition = Fixture.productDefinition();
super.depositAccountManager.create(productDefinition);
super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
final String openedOn = LocalDate.of(2017, 5, 27).toString();
productInstance.setOpenedOn(openedOn);
super.depositAccountManager.create(productInstance);
super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
final List <ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
final ProductInstance foundProductInstance = productInstances.get(0);
this.mockMvc.perform(post("/instances/" + foundProductInstance.getAccountIdentifier())
.param("command", "CLOSE")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isAccepted())
.andDo(document("document-close-instance"));
}