Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created November 2, 2021 07:39
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 eliasnogueira/cfecfee8e1ac2db2279f66df2b03942d to your computer and use it in GitHub Desktop.
Save eliasnogueira/cfecfee8e1ac2db2279f66df2b03942d to your computer and use it in GitHub Desktop.
class PostTest {
@Test
void postUsingObjectMapping() {
User user = new User("Elias", "Principal Engineer");
given().
contentType(ContentType.JSON).
body(user).
when().
post("/users").
then().
statusCode(HttpStatus.SC_CREATED).
body(
"name", is(user.getNama()),
"job", is(user.getJob()),
"id", notNullValue(),
"createdAt", notNullValue()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment