public void documentFetchScans()

in component-test/src/main/java/org/apache/fineract/cn/customer/IdentificationApiDocumentation.java [304:338]


  public void documentFetchScans ( ) throws Exception {
    final Customer customerOne = CustomerGenerator.createRandomCustomer();
    customerOne.setIdentifier("ato'oh");
    final String customerIdentifier = customerOne.getIdentifier();

    this.customerManager.createCustomer(customerOne);
    this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customerIdentifier);

    final IdentificationCard identificationCard = IdentificationCardGenerator.createRandomIdentificationCard();
    identificationCard.setNumber("CT13B0987");
    this.customerManager.createIdentificationCard(customerIdentifier, identificationCard);
    this.eventRecorder.wait(CustomerEventConstants.POST_IDENTIFICATION_CARD, identificationCard.getNumber());
    final String identificationCardNumber = identificationCard.getNumber();

    IdentificationCardScan iDCardOne = this.createScan(customerIdentifier, identificationCardNumber, "ScanOne", "First Scan");
    IdentificationCardScan iDCardTwo = this.createScan(customerIdentifier, identificationCardNumber, "ScanTwo", "Second Scan");
    IdentificationCardScan iDCardThree = this.createScan(customerIdentifier, identificationCardNumber, "ScanThree", "Three Scan");

    final List <IdentificationCardScan> cardScans = this.customerManager.fetchIdentificationCardScans(customerIdentifier, identificationCardNumber);

    Gson gson = new Gson();
    this.mockMvc.perform(get("/customers/" + customerIdentifier + "/identifications/" + identificationCardNumber + "/scans")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(gson.toJson(cardScans))
            .accept(MediaType.ALL_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-fetch-scans", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
                    responseFields(
                            fieldWithPath("[].identifier").description("First scan's identifier"),
                            fieldWithPath("[].description").description("First scan's description"),
                            fieldWithPath("[1].identifier").description("Second scan's identifier"),
                            fieldWithPath("[1].description").description("Second scan's description"),
                            fieldWithPath("[2].identifier").description("Third scan's identifier"),
                            fieldWithPath("[2].description").description("Third scan's description"))));
  }