I have the following mocking
mockMvc.perform(get("/bk/getBks?sd="+1262296800000L+"&nod=3"))
.andDo(print());
This is my controller
@RestController
@RequestMapping("/bk")
public class BkController {
@RequestMapping(value = "/getBks", method = RequestMethod.GET)
public ResponseEntity<List<BkDTO>> getBks(@Valid @RequestBody GetBksForm form, BindingResult result) throws ... {
return ...;
}
}
And my validation form
public class GetBksForm {
@Min(1000000000000L)
private Long sd;
@Min(1)
private int nod;
setters and getters
}
The problem is that it keeps throwing the following exception and I can't figure out why.
MockHttpServletRequest:
HTTP Method = GET
Request URI = /bk/getBks
Parameters = {sd=[1262296800000], nod=[3]}
Headers = {}
Handler:
Type = com.ihbs.booking.BkController
Method = public org.springframework.http.ResponseEntity<java.util.List<com.ihbs.bk.BkDTO>> com.ihbs.bk.BkController.getBks(com.ihbs.bk.GetBksForm,org.springframework.validation.BindingResult) throws ...
Async:
Async started = false
Async result = null
Resolved Exception:
Type = org.springframework.http.converter.HttpMessageNotReadableException
ModelAndView:
View name = null
View = null
Model = null
FlashMap:
MockHttpServletResponse:
Status = 400
Error message = null
Headers = {}
Content type = null
Body =
Forwarded URL = null
Redirected URL = null
Cookies = []
I looks like it finds the handler but it doesn't know how to read the request and I can't figure out why.