Created
March 20, 2021 14:43
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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