Java Code Examples for io.restassured.RestAssured#given()

The following examples show how to use io.restassured.RestAssured#given() . 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: GraphQLTest.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Test
public void testSchema() {
    RequestSpecification request = RestAssured.given();
    request.accept(MEDIATYPE_TEXT);
    request.contentType(MEDIATYPE_TEXT);
    Response response = request.get("/graphql/schema.graphql");
    String body = response.body().asString();
    LOG.error(body);

    Assertions.assertEquals(200, response.statusCode());
    Assertions.assertTrue(body.contains("\"Query root\""));
    Assertions.assertTrue(body.contains("type Query {"));
    Assertions.assertTrue(body.contains("ping: TestPojo"));
}
 
Example 2
Source File: AbstractApiTests.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected static RequestSpecification given(@Nullable @CheckForNull String token) {
  RequestSpecification requestSpecification = RestAssured.given();
  if (token != null) {
    requestSpecification = requestSpecification.header("x-molgenis-token", token);
  }
  return requestSpecification.accept(APPLICATION_JSON_VALUE);
}
 
Example 3
Source File: AbstractDocumentationTests.java    From spring-cloud-netflix with Apache License 2.0 4 votes vote down vote up
protected RequestSpecification document(Object body) {
	RestDocumentationFilter filter = filter("{method-name}");
	RequestSpecification assured = RestAssured.given(spec(body, filter));
	return assured.filter(filter);
}
 
Example 4
Source File: AbstractDocumentationTests.java    From spring-cloud-netflix with Apache License 2.0 4 votes vote down vote up
protected RequestSpecification document(String name, Object body) {
	RestDocumentationFilter filter = filter(name);
	RequestSpecification assured = RestAssured.given(spec(body, filter));
	return assured.filter(filter);
}