程序包 org.springframework.test.web.servlet.setup
Contains built-in
MockMvcBuilder
implementations. Use MockMvcBuilders
to access to instances of those implementations.接口概要 接口 说明 ConfigurableMockMvcBuilder<B extends ConfigurableMockMvcBuilder<B>> Defines common methods for building aMockMvc
.MockMvcConfigurer Allows a sub-class to encapsulate logic for pre-configuring aConfigurableMockMvcBuilder
for some specific purpose.类概要 类 说明 AbstractMockMvcBuilder<B extends AbstractMockMvcBuilder<B>> An abstract implementation ofMockMvcBuilder
with common methods for configuring filters, default request properties, global expectations and global result actions.DefaultMockMvcBuilder A concrete implementation ofAbstractMockMvcBuilder
that provides theWebApplicationContext
supplied to it as a constructor argument.MockMvcBuilders The main class to import in order to access all availableMockMvcBuilder
s.MockMvcConfigurerAdapter An empty method implementation ofMockMvcConfigurer
.StandaloneMockMvcBuilder AMockMvcBuilder
that accepts@Controller
registrations thus allowing full control over the instantiation and initialization of controllers and their dependencies similar to plain unit tests, and also making it possible to test one controller at a time.