I've got a controller with some parameters. It's RequestMethod
is POST
. But I send POST request with some parameters in URI and some in the body.
But when I write such test
mockMvc.perform(
post("/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.param(..uri parameter..).content(..body parameters..))
.andExpect(status().isOk()).andExpect(content().string("SUCCESS"));
I always got Status expected:<200> but was:<400>
.
How to write this test properly?