public void documentFindEmployee()

in component-test/src/main/java/org/apache/fineract/cn/office/EmployeeApiDocumentation.java [117:155]


  public void documentFindEmployee ( ) throws Exception {

    final Office office = OfficeFactory.createRandomOffice();
    office.setIdentifier("myOffice");
    this.organizationManager.createOffice(office);
    this.eventRecorder.wait(EventConstants.OPERATION_POST_OFFICE, office.getIdentifier());

    ContactDetail firstContact = new ContactDetail();
    firstContact.setType(ContactDetail.Type.MOBILE.name());
    firstContact.setGroup(ContactDetail.Group.PRIVATE.name());
    firstContact.setValue("699009900");
    firstContact.setPreferenceLevel(new Integer(1));

    List <ContactDetail> contactsOne = new ArrayList <>();
    contactsOne.add(firstContact);

    final Employee employee = EmployeeFactory.createRandomEmployee();
    employee.setIdentifier("emNo1");
    employee.setGivenName("Ojong");
    employee.setMiddleName("Cho");
    employee.setSurname("Tah");
    employee.setAssignedOffice(office.getIdentifier());
    employee.setContactDetails(contactsOne);
    this.organizationManager.createEmployee(employee);
    this.eventRecorder.wait(EventConstants.OPERATION_POST_EMPLOYEE, employee.getIdentifier());

    this.mockMvc.perform(get("/employees/" + employee.getIdentifier())
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .accept(MediaType.ALL_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-find-employee", preprocessResponse(prettyPrint()),
                    responseFields(
                            fieldWithPath("identifier").description("first employee's identifier"),
                            fieldWithPath("givenName").description(" first employee given name"),
                            fieldWithPath("middleName").description("first employee's middle name"),
                            fieldWithPath("surname").description("first employee's surname"),
                            fieldWithPath("assignedOffice").description("first employee's assigned office"),
                            fieldWithPath("contactDetails").type("List<ContactDetail>").description("first employee's contact details"))));
  }