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 garystafford/8a5e636263cf609e5a5121715fec8ea7 to your computer and use it in GitHub Desktop.
Save garystafford/8a5e636263cf609e5a5121715fec8ea7 to your computer and use it in GitHub Desktop.
@Test
void findById() {
// Get the first 'id' available
int id = get(ResourcePath + "?limit=1")
.then()
.extract()
.path("[0].id");
given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
.when()
.get(ResourcePath + "/{id}", id)
.then()
.assertThat()
.contentType(JSON)
.statusCode(200)
.body("id", Matchers.equalTo(id));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment