in component-test/src/main/java/org/apache/fineract/cn/customer/IdentificationApiDocumentation.java [371:401]
public void documentFindScanWithImage ( ) throws Exception {
final Customer customer = CustomerGenerator.createRandomCustomer();
customer.setIdentifier("akong");
this.customerManager.createCustomer(customer);
this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customer.getIdentifier());
final String customerIdentifier = customer.getIdentifier();
final IdentificationCard identificationCard = IdentificationCardGenerator.createRandomIdentificationCard();
identificationCard.setNumber("SC18C0999");
this.customerManager.createIdentificationCard(customerIdentifier, identificationCard);
this.eventRecorder.wait(CustomerEventConstants.POST_IDENTIFICATION_CARD, identificationCard.getNumber());
final String identificationCardNumber = identificationCard.getNumber();
final IdentificationCardScan scan = ScanGenerator.createRandomScan(null);
scan.setIdentifier("scanIdentity");
scan.setDescription("scanDescription");
final byte[] imageInBytes = "iCareAboutImage".getBytes();
final MockMultipartFile image = new MockMultipartFile("image", "test.png", MediaType.IMAGE_PNG_VALUE, imageInBytes);
this.customerManager.postIdentificationCardScan(customerIdentifier, identificationCardNumber, scan.getIdentifier(), scan.getDescription(), image);
this.eventRecorder.wait(CustomerEventConstants.POST_IDENTIFICATION_CARD_SCAN, new ScanEvent(identificationCardNumber, scan.getIdentifier()));
this.mockMvc.perform(get("/customers/" + customerIdentifier + "/identifications/"
+ identificationCardNumber + "/scans/" + scan.getIdentifier() + "/image")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(imageInBytes)
.accept(MediaType.ALL_VALUE))
.andExpect(status().isOk())
.andDo(document("document-find-scan-with-image", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
}