Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created March 20, 2021 14:43
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/8075505987e83bd7bab4c2f24b488697 to your computer and use it in GitHub Desktop.
Save eliasnogueira/8075505987e83bd7bab4c2f24b488697 to your computer and use it in GitHub Desktop.
Example of an object being used to send a request on RestAssured as a HashMap
class PostTest {
@Test
void postUsingHashMap() {
Map<String, Object> user = new HashMap<>();
user.put("name", "Elias");
user.put("job", "Principal Engineer");
given().
contentType(ContentType.JSON).
body(user).
when().
post("/users").
then().
statusCode(HttpStatus.SC_CREATED).
body(
"name", is(user.get("name")),
"job", is(user.get("job")),
"id", notNullValue(),
"createdAt", notNullValue()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment