接口 ResultHandler

  • 所有已知实现类:
    PrintingResultHandler

    public interface ResultHandler
    A ResultHandler performs a generic action on the result of an executed request — for example, printing debug information.

    See static factory methods in MockMvcResultHandlers.

    Example

     import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
     import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*;
     import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
    
     // ...
    
     WebApplicationContext wac = ...;
    
     MockMvc mockMvc = webAppContextSetup(wac).build();
    
     mockMvc.perform(get("/form")).andDo(print());
     
    从以下版本开始:
    3.2
    作者:
    Rossen Stoyanchev, Sam Brannen
    • 方法详细资料

      • handle

        void handle​(MvcResult result)
             throws Exception
        Perform an action on the given result.
        参数:
        result - the result of the executed request
        抛出:
        Exception - if a failure occurs