Spring @Controller Unittest @RequestMapping

Having a basic Spring Contoller, I would like Unittest query matching (not the method itself) if the method is doCriticalStuffreally called

package org.foo;

@Controller
public class HelloWorldController implements IHelloWorldController
{
   @RequestMapping(value = "/b/c/", method = RequestMethod.GET)
   public void doCriticalStuff(HttpServletRequest request, HttpServletResponse response){
      //...
   }
}

Now I guess this through curl -X GET http://myIP:myPort/b/c/the command line in manual mode. Any ideas on how to automate it? I can set up a Jetty instance, send a request and see if I get the expected response, but is there an easier way provided by Spring?

Related Post: How to Test Binder / Property Editors Used on Spring 2.5 Controllers

+3
source share
1 answer

AnnotationMethodHandlerAdapter .handle. mock , spring .

+3

Source: https://habr.com/ru/post/1751621/


All Articles