public void documentReplacePortrait()

in component-test/src/main/java/org/apache/fineract/cn/customer/CustomerApiDocumentation.java [1395:1454]


  public void documentReplacePortrait ( ) throws Exception {
    final Customer customer = CustomerGenerator.createRandomCustomer();

    DateOfBirth dateOfBirth = new DateOfBirth();
    dateOfBirth.setYear(Integer.valueOf(1996));
    dateOfBirth.setMonth(Integer.valueOf(7));
    dateOfBirth.setDay(Integer.valueOf(7));

    Address address = new Address();
    address.setStreet("Bona");
    address.setCity("Buea");
    address.setRegion("SWR");
    address.setPostalCode("8050");
    address.setCountryCode("CM");
    address.setCountry("Cameroon");

    ContactDetail orangeContact = new ContactDetail();
    orangeContact.setType(ContactDetail.Type.MOBILE.name());
    orangeContact.setGroup(ContactDetail.Group.PRIVATE.name());
    orangeContact.setValue("699411349");
    orangeContact.setPreferenceLevel(Integer.valueOf(1));
    orangeContact.setValidated(Boolean.FALSE);

    List <ContactDetail> contactDetails = new ArrayList <>();
    contactDetails.add(orangeContact);

    customer.setIdentifier("osong");
    customer.setType(Customer.Type.PERSON.name());
    customer.setGivenName("Osong");
    customer.setMiddleName("Arrey");
    customer.setSurname("Besong");
    customer.setDateOfBirth(dateOfBirth);
    customer.setMember(Boolean.TRUE);
    customer.setAssignedOffice("Bona");
    customer.setAssignedEmployee("Egbereke E");
    customer.setAddress(address);
    customer.setContactDetails(contactDetails);
    customer.setCurrentState(Customer.State.PENDING.name());
    customer.setAccountBeneficiary("wife");
    customer.setReferenceCustomer("mianda");
    customer.setApplicationDate(LocalDate.ofYearDay(2017, 290).toString());
    customer.setLastModifiedBy("Ashu Arrey");
    customer.setLastModifiedOn(LocalDate.ofYearDay(2018, 11).toString());

    this.customerManager.createCustomer(customer);
    this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customer.getIdentifier());

    final MockMultipartFile firstFile = new MockMultipartFile("portrait", "test.png", MediaType.IMAGE_PNG_VALUE, "i don't care".getBytes());

    this.customerManager.postPortrait(customer.getIdentifier(), firstFile);

    this.eventRecorder.wait(CustomerEventConstants.POST_PORTRAIT, customer.getIdentifier());

    final MockMultipartFile secondFile = new MockMultipartFile("portrait", "test.png", MediaType.IMAGE_PNG_VALUE, "i care".getBytes());

    this.mockMvc.perform(MockMvcRequestBuilders.fileUpload("/customers/" + customer.getIdentifier() + "/portrait")
            .file(secondFile))
            .andExpect(status().isAccepted())
            .andDo(document("document-replace-portrait"));
  }