Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannyshain/ba638151b245d965b3606c30d56ee549 to your computer and use it in GitHub Desktop.
Save dannyshain/ba638151b245d965b3606c30d56ee549 to your computer and use it in GitHub Desktop.
@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