Spring: Test JSP Output in JUnit Test
问题 We have a API, which returns the JSP as the view, for example: @RequestMapping(value = "/cricket/{matchId}", method = RequestMethod.GET) public String getCricketWebView(HttpServletRequest request, @PathVariable("matchId") Integer matchId, ModelMap mv){ try{ return "webforms/cricket"; }catch(Exception e){ e.printStackTrace(); } return ""; } I wrote a unit test to test this out as follows: @Test public void test_cricket() { try { MvcResult result =this.mockMvc.perform(get(BASE + "/cricket/123")