After a spending about 2 days researching on the HttpRequestMethodNotSupportedException thrown when running AbstractController.handleRequest in my test, I decided to view spring source code to see the real cause of this problem.

The problem was when creating MockHttpServletRequest, it doesn't set a default method name. To solve this problem, I simply added a request method type on the mock request object. See the following code:

request = new MockHttpServletRequest();
request.setMethod("POST");

0 comments:

Newer Post Older Post Home

Blogger Template by Blogcrowds