Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Test
public void getLaunches_checkMissionName_shouldBeThaicom6_usingJSONObject() {
GraphQLQuery query = new GraphQLQuery();
query.setQuery("query getLaunches($limit: Int!){ launches(limit: $limit) { mission_name } }");
JSONObject variables = new JSONObject();
variables.put("limit", 10);
query.setVariables(variables.toString());
given().
contentType(ContentType.JSON).
body(query).
when().
post("https://api.spacex.land/graphql/").
then().
assertThat().
statusCode(200).
and().
body("data.launches[0].mission_name", equalTo("Thaicom 6"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment