mardi 22 décembre 2020

Spring MVC controller testing [duplicate]

New at testing and after doing much research not sure where to start based on examples I've seen.

The below controller is used in a spring boot client app that makes only GET requests to the REST API that returns a response as a list. Here the response is set as an attribute on the model and then returned as a String to be rendered in the view... if I got that 100% correct.

Question : can someone share an example on how I need to write a test for this controller? Do I need to just assert that the controller attribute is not null?

 @Controller 
 @RequestMapping
 public class WebController {
    
      @GetMapping("/ListA") 
      public String viewListAController(Model model) {
          
          return "ListA";

      }
 }  

Aucun commentaire:

Enregistrer un commentaire