Java Code Examples for io.restassured.specification.RequestSpecification#filter()
The following examples show how to use
io.restassured.specification.RequestSpecification#filter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestControllerIntegrationTestBase.java From genie with Apache License 2.0 | 5 votes |
<R extends ExecutionEnvironmentDTO> String createConfigResource( @NotNull final R resource, @Nullable final RestDocumentationFilter documentationFilter ) throws Exception { final String endpoint; if (resource instanceof Application) { endpoint = APPLICATIONS_API; } else if (resource instanceof Cluster) { endpoint = CLUSTERS_API; } else if (resource instanceof Command) { endpoint = COMMANDS_API; } else { throw new IllegalArgumentException("Unexpected type: " + resource.getClass().getCanonicalName()); } final RequestSpecification configRequestSpec = RestAssured .given(this.requestSpecification) .contentType(MediaType.APPLICATION_JSON_VALUE) .body(GenieObjectMapper.getMapper().writeValueAsBytes(resource)); if (documentationFilter != null) { configRequestSpec.filter(documentationFilter); } return this.getIdFromLocation( configRequestSpec .when() .port(this.port) .post(endpoint) .then() .statusCode(Matchers.is(HttpStatus.CREATED.value())) .header(HttpHeaders.LOCATION, Matchers.notNullValue()) .extract() .header(HttpHeaders.LOCATION) ); }
Example 2
Source File: AbstractDocumentationTests.java From spring-cloud-netflix with Apache License 2.0 | 4 votes |
protected RequestSpecification document(Object body) { RestDocumentationFilter filter = filter("{method-name}"); RequestSpecification assured = RestAssured.given(spec(body, filter)); return assured.filter(filter); }
Example 3
Source File: AbstractDocumentationTests.java From spring-cloud-netflix with Apache License 2.0 | 4 votes |
protected RequestSpecification document(String name, Object body) { RestDocumentationFilter filter = filter(name); RequestSpecification assured = RestAssured.given(spec(body, filter)); return assured.filter(filter); }