public void documentFindGroup()

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


  public void documentFindGroup ( ) throws Exception {

    final Cycle groupCycle = new Cycle();
    groupCycle.setNumberOfMeetings(12);
    groupCycle.setFrequency(Cycle.Frequency.MONTHLY.name());
    groupCycle.setAdjustment(Cycle.Adjustment.NEXT_BUSINESS_DAY.name());

    final GroupDefinition randomGroupDefinition = GroupDefinitionGenerator.createRandomGroupDefinition();
    randomGroupDefinition.setDescription("Group Defininition 202");
    randomGroupDefinition.setMinimalSize(Integer.valueOf(5));
    randomGroupDefinition.setMaximalSize(Integer.valueOf(10));
    randomGroupDefinition.setCycle(groupCycle);

    this.testSubject.createGroupDefinition(randomGroupDefinition);
    this.eventRecorder.wait(EventConstants.POST_GROUP_DEFINITION, randomGroupDefinition.getIdentifier());

    Set <String> leadership = new HashSet <>();
    leadership.add("Ndi");
    leadership.add("Mele");

    Set <String> membership = new HashSet <>();
    membership.add("Kamgue");
    membership.add("Etta");
    membership.add("Awasom");

    final Address address = new Address();
    address.setStreet("Ghana Street");
    address.setCity("Bamenda");
    address.setRegion("NWR");
    address.setPostalCode("8050");
    address.setCountry("Cameroon");
    address.setCountryCode("CM");

    final Group randomGroup = GroupGenerator.createRandomGroup(randomGroupDefinition.getIdentifier());
    randomGroup.setGroupDefinitionIdentifier(randomGroupDefinition.getIdentifier());
    randomGroup.setName("SDLE Group");
    randomGroup.setOffice("Bambui");
    randomGroup.setAssignedEmployee("Tabah Tih");
    randomGroup.setWeekday(Group.Weekday.SATURDAY.getValue());
    randomGroup.setLeaders(leadership);
    randomGroup.setMembers(membership);
    randomGroup.setAddress(address);

    this.testSubject.createGroup(randomGroup);
    this.eventRecorder.wait(EventConstants.POST_GROUP, randomGroup.getIdentifier());

    this.mockMvc.perform(get("/groups/" + randomGroup.getIdentifier())
            .accept(MediaType.ALL_VALUE)
            .contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-find-group", preprocessResponse(prettyPrint()),
                    responseFields(
                            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"),
                            fieldWithPath("status").description("Status " +
                                    " + \n" +
                                    "*enum* _Status_ { + \n" +
                                    "    PENDING, + \n" +
                                    "    ACTIVE, + \n" +
                                    "    CLOSED + \n" +
                                    "  }"),
                            fieldWithPath("createdOn").description(""),
                            fieldWithPath("createdBy").description(""),
                            fieldWithPath("lastModifiedOn").description(""),
                            fieldWithPath("lastModifiedBy").description("")
                    )));
  }