Example usage for org.springframework.restdocs.payload PayloadDocumentation subsectionWithPath

List of usage examples for org.springframework.restdocs.payload PayloadDocumentation subsectionWithPath

Introduction

In this page you can find the example usage for org.springframework.restdocs.payload PayloadDocumentation subsectionWithPath.

Prototype

public static SubsectionDescriptor subsectionWithPath(String path) 

Source Link

Document

Creates a FieldDescriptor that describes a subsection, i.e.

Usage

From source file:com.netflix.genie.web.controllers.JobRestControllerIntegrationTest.java

private void checkJobApplications(final int documentationId, final String id) {
    final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document(
            "{class-name}/" + documentationId + "/getJobApplications/", Snippets.ID_PATH_PARAM, // Path parameters
            Snippets.HAL_CONTENT_TYPE_HEADER, // Response Headers
            PayloadDocumentation.responseFields(PayloadDocumentation.subsectionWithPath("[]")
                    .description("The applications for the job").attributes(Snippets.EMPTY_CONSTRAINTS)) // Response fields
    );/*  w ww.  jav a 2s. co  m*/

    RestAssured.given(this.getRequestSpecification()).filter(getResultFilter).when().port(this.port)
            .get(JOBS_API + "/{id}/applications", id).then().statusCode(Matchers.is(HttpStatus.OK.value()))
            .contentType(Matchers.is(MediaTypes.HAL_JSON_UTF8_VALUE)).body("$", Matchers.hasSize(2))
            .body("[0].id", Matchers.is(APP1_ID)).body("[1].id", Matchers.is(APP2_ID));
}