public void documentCreateEmployee()

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


  public void documentCreateEmployee ( ) throws Exception {

    final Employee employee = EmployeeFactory.createRandomEmployee();

    final Office office = OfficeFactory.createRandomOffice();
    office.setIdentifier("Accra");

    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("677889900");
    firstContact.setPreferenceLevel(new Integer(1));

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

    employee.setIdentifier("employ0010");
    employee.setGivenName("Chale");
    employee.setMiddleName("Asamoah");
    employee.setSurname("Yamoah");
    employee.setAssignedOffice("Accra");
    employee.setContactDetails(contacts);

    Gson gson = new Gson();
    this.mockMvc.perform(post("/employees")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(gson.toJson(employee)))
            .andExpect(status().isAccepted())
            .andDo(document("document-create-employee", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
                    requestFields(
                            fieldWithPath("identifier").description("Employee's identifier"),
                            fieldWithPath("givenName").description(" Employee given name"),
                            fieldWithPath("middleName").description("Employee's middle name"),
                            fieldWithPath("surname").description("Employee's surname"),
                            fieldWithPath("assignedOffice").description("Employee's assigned office"),
                            fieldWithPath("contactDetails").type("List<ContactDetail>").description("Employee's contact details"))));
  }