Skip to content

API accepts a JSON payload (JUnit 5)

### ✅ API accepts a JSON payload
- **Given** the client has the following JSON payload
**Payload**
```json
{
"email": "[email protected]",
"password": "secret",
"rememberMe": true
}
```
- **When** the client sends the request
- **Then** the response status should be 200
- **And** the response body should include "token"
import dev.executablestories.junit5.Story
import org.junit.jupiter.api.Test
class ApiTest {
@Test
fun `api accepts a json payload`() {
Story.init("API accepts a JSON payload")
Story.given("the client has the following JSON payload")
Story.json("Payload", mapOf(
"email" to "[email protected]",
"password" to "secret",
"rememberMe" to true
))
Story.`when`("the client sends the request")
Story.then("the response status should be 200")
Story.then("the response body should include \"token\"")
}
}