接口 ResultHandler

所有已知实现类:
MockMvcResultHandlers.LoggingResultHandler, MockMvcResultHandlers.PrintWriterPrintingResultHandler, PrintingResultHandler
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface 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 cn.taketoday.test.web.servlet.request.MockMvcRequestBuilders.*;
 import static cn.taketoday.test.web.servlet.result.MockMvcResultHandlers.*;
 import static cn.taketoday.test.web.servlet.setup.MockMvcBuilders.*;

 // ...

 WebApplicationContext wac = ...;

 MockMvc mockMvc = webAppContextSetup(wac).build();

 mockMvc.perform(get("/form")).andDo(print());
 
从以下版本开始:
4.0
作者:
Rossen Stoyanchev, Sam Brannen
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    handle(MvcResult result)
    Perform an action on the given result.
  • 方法详细资料

    • 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