Interface ResultHandler

All Known Implementing Classes:
PrintingResultHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@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 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());
 
Since:
3.2
Author:
Rossen Stoyanchev, Sam Brannen
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handle(MvcResult result)
    Perform an action on the given result.
  • Method Details

    • handle

      void handle(MvcResult result) throws Exception
      Perform an action on the given result.
      Parameters:
      result - the result of the executed request
      Throws:
      Exception - if a failure occurs