Created
March 20, 2021 14:34
-
-
Save eliasnogueira/df0ca2cff0380b51a947a7e0c35aa85c to your computer and use it in GitHub Desktop.
Example of an object being used in a post request as a String
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 postUsingStringConcatenation() { | |
String user = "{\"name\":\"Elias\",\"job\":\"Principal Engineer\"}"; | |
given(). | |
contentType(ContentType.JSON). | |
body(user). | |
when(). | |
post("/users"). | |
then(). | |
statusCode(HttpStatus.SC_CREATED). | |
body( | |
"name", is("Elias"), | |
"job", is("Principal Engineer"), | |
"id", notNullValue(), | |
"createdAt", notNullValue() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment