java - How to TestNG tests a @PreAuthorize annotation and its spring EL specified by a spring MVC Controller? -


I defined this method in my Spring MVC controller

  @PreAuthorize (" @RequestMapping (method = RequestMethod.POST, value = "/ trade / createrequisition") public @ResponseBody void createRequisition (@RequestBody CreateRequisitionRO [] request, @RequestHeader (" Valid Only ") Boolean Valid Only) {.....}   

Then in my TestGG test, I would like to call this method and make sure PreAuthorize status is verified. . When I call this method in a normal way (do not test), Preauthorize gets verified.

If this is possible, how to test this annotation in a testgag test and how to catch an exception, if he throws one?

Best Relationship

In my opinion you do not have to worry about testing Chapters Exam You should only test your method.

Instead, you should write an integration or functional test for this scenario. Since this whole application will be launched, you can test all the circumstances.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -