public void documentUpdateGroup()

in component-test/src/main/java/org/apache/fineract/cn/group/GroupApiDocumentation.java [250:296]


  public void documentUpdateGroup ( ) 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());

    randomGroup.setName(randomGroup.getName() + "Updated");
    randomGroup.setWeekday(Group.Weekday.SATURDAY.getValue());

    Gson serialize = new Gson();
    this.mockMvc.perform(put("/groups/" + randomGroup.getIdentifier())
            .accept(MediaType.APPLICATION_JSON_VALUE)
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(serialize.toJson(randomGroup)))
            .andExpect(status().isAccepted())
            .andDo(document("document-update-group", preprocessRequest(prettyPrint()),
                    requestFields(
                            fieldWithPath("identifier").description("Group Id"),
                            fieldWithPath("groupDefinitionIdentifier").description("Group Definition Id"),
                            fieldWithPath("name").description("Group's name"),
                            fieldWithPath("leaders").type("Set<String>").description("Group's leaders"),
                            fieldWithPath("members").type("Set<String>").description("Group's members"),
                            fieldWithPath("office").description("Group's office"),
                            fieldWithPath("assignedEmployee").description("Assigned Employee"),
                            fieldWithPath("weekday").type("Integer").description("Weekday for group meeting " +
                                    " \n + " +
                                    " *enum* _Weekday_ { + \n" +
                                    "    MONDAY(1), + \n" +
                                    "    TUESDAY(2), + \n" +
                                    "    WEDNESDAY(3), + \n" +
                                    "    THURSDAY(4), + \n" +
                                    "    FRIDAY(5), + \n" +
                                    "    SATURDAY(6), + \n" +
                                    "    SUNDAY(7) + \n " +
                                    " } \n +"),
                            fieldWithPath("address.street").description("Office street"),
                            fieldWithPath("address.city").description("Office city"),
                            fieldWithPath("address.region").description("Office region"),
                            fieldWithPath("address.postalCode").description("Office postal code"),
                            fieldWithPath("address.countryCode").description("Office country code"),
                            fieldWithPath("address.country").description("Office country")
                    )));
  }