in component-test/src/main/java/org/apache/fineract/cn/group/GroupApiDocumentation.java [299:337]
public void documentActivateGroup ( ) throws Exception {
final GroupDefinition randomGroupDefinition = GroupDefinitionGenerator.createRandomGroupDefinition();
this.testSubject.createGroupDefinition(randomGroupDefinition);
this.eventRecorder.wait(EventConstants.POST_GROUP_DEFINITION, randomGroupDefinition.getIdentifier());
final Group randomGroup = GroupGenerator.createRandomGroup(randomGroupDefinition.getIdentifier());
this.testSubject.createGroup(randomGroup);
this.eventRecorder.wait(EventConstants.POST_GROUP, randomGroup.getIdentifier());
final Group fetchedGroup = this.testSubject.findGroup(randomGroup.getIdentifier());
Assert.assertEquals(Group.Status.PENDING.name(), fetchedGroup.getStatus());
final GroupCommand activate = new GroupCommand();
activate.setAction(GroupCommand.Action.ACTIVATE.name());
activate.setNote("Activate Note" + RandomStringUtils.randomAlphanumeric(3));
activate.setCreatedBy(SuiteTestEnvironment.TEST_USER);
activate.setCreatedOn(ZonedDateTime.now(Clock.systemUTC()).format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
Gson serialize = new Gson();
this.mockMvc.perform(post("/groups/" + randomGroup.getIdentifier() + "/commands")
.accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(serialize.toJson(activate)))
.andExpect(status().isAccepted())
.andDo(document("document-activate-group", preprocessRequest(prettyPrint()),
requestFields(
fieldWithPath("action").description("Action " +
"" +
"*enum* _Action_ { + \n" +
" ACTIVATE, + \n" +
" CLOSE, + \n" +
" REOPEN + \n" +
" }"),
fieldWithPath("note").description("Group NOte"),
fieldWithPath("createdBy").description("Assigned Employee to Group"),
fieldWithPath("createdOn").type("String").description("Date when group was created")
)));
}