类的使用
org.springframework.test.web.servlet.MockMvc
使用MockMvc的程序包 程序包 说明 org.springframework.test.web.client Contains client-side REST testing support.org.springframework.test.web.servlet Contains server-side support for testing Spring MVC applications.org.springframework.test.web.servlet.htmlunit Server-side support for testing Spring MVC applications withMockMvc
and HtmlUnit.org.springframework.test.web.servlet.htmlunit.webdriver Server-side support for testing Spring MVC applications withMockMvc
and the SeleniumHtmlUnitDriver
.org.springframework.test.web.servlet.setup Contains built-inMockMvcBuilder
implementations.org.springframework.test.web.client中MockMvc的使用
参数类型为MockMvc的org.springframework.test.web.client中的构造器 构造器 说明 MockMvcClientHttpRequestFactory(MockMvc mockMvc)
org.springframework.test.web.servlet中MockMvc的使用
返回MockMvc的org.springframework.test.web.servlet中的方法 修饰符和类型 方法 说明 MockMvc
MockMvcBuilder. build()
Build aMockMvc
instance.protected MockMvc
MockMvcBuilderSupport. createMockMvc(Filter[] filters, MockServletConfig servletConfig, WebApplicationContext webAppContext, RequestBuilder defaultRequestBuilder, List<ResultMatcher> globalResultMatchers, List<ResultHandler> globalResultHandlers, List<DispatcherServletCustomizer> dispatcherServletCustomizers)
org.springframework.test.web.servlet.htmlunit中MockMvc的使用
参数类型为MockMvc的org.springframework.test.web.servlet.htmlunit中的方法 修饰符和类型 方法 说明 static MockMvcWebClientBuilder
MockMvcWebClientBuilder. mockMvcSetup(MockMvc mockMvc)
Create a newMockMvcWebClientBuilder
based on the suppliedMockMvc
instance.参数类型为MockMvc的org.springframework.test.web.servlet.htmlunit中的构造器 构造器 说明 MockMvcWebClientBuilder(MockMvc mockMvc)
MockMvcWebConnection(MockMvc mockMvc, com.gargoylesoftware.htmlunit.WebClient webClient)
Create a new instance that assumes the context path of the application is""
(i.e., the root context).MockMvcWebConnection(MockMvc mockMvc, com.gargoylesoftware.htmlunit.WebClient webClient, String contextPath)
Create a new instance with the specified context path.MockMvcWebConnectionBuilderSupport(MockMvc mockMvc)
Create a new instance using the suppliedMockMvc
instance.org.springframework.test.web.servlet.htmlunit.webdriver中MockMvc的使用
参数类型为MockMvc的org.springframework.test.web.servlet.htmlunit.webdriver中的方法 修饰符和类型 方法 说明 static MockMvcHtmlUnitDriverBuilder
MockMvcHtmlUnitDriverBuilder. mockMvcSetup(MockMvc mockMvc)
Create a newMockMvcHtmlUnitDriverBuilder
based on the suppliedMockMvc
instance.参数类型为MockMvc的org.springframework.test.web.servlet.htmlunit.webdriver中的构造器 构造器 说明 MockMvcHtmlUnitDriverBuilder(MockMvc mockMvc)
org.springframework.test.web.servlet.setup中MockMvc的使用
返回MockMvc的org.springframework.test.web.servlet.setup中的方法 修饰符和类型 方法 说明 MockMvc
AbstractMockMvcBuilder. build()
Build aMockMvc
instance.