mardi 31 mai 2016

How I can Test my Spring MVC app?

I use Spring MVC + Spring Security + Spring Data+Spring Boot in my web appl. Give me an example how I can test my controllers, please. I am complete newbie in testing. Example controller:

@Controller
@RequestMapping("/user/add")
@ComponentScan("services")
public class AddController extends WebMvcConfigurerAdapter {
    @Autowired
    private Services services;
    @Autowired
    private UtilService utilService;

    private static final Logger logger = Logger.getLogger(AddController.class);

 @RequestMapping("/agenttypeadd")
 public String addAddAgentType(@RequestParam String name ) {
            services.addAgentType(new AgentType(name));
            return "redirect:/main";

    }
}

Aucun commentaire:

Enregistrer un commentaire