public abstract class MockMvcWebConnectionBuilderSupport<T extends MockMvcWebConnectionBuilderSupport<T>>
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
MockMvcWebConnectionBuilderSupport(org.springframework.test.web.servlet.MockMvc mockMvc)
Creates a new instance using a MockMvc instance
|
protected |
MockMvcWebConnectionBuilderSupport(org.springframework.web.context.WebApplicationContext context)
Creates a new instance using a WebApplicationContext
|
protected |
MockMvcWebConnectionBuilderSupport(org.springframework.web.context.WebApplicationContext context,
org.springframework.test.web.servlet.setup.MockMvcConfigurer configurer)
Creates a new instance using a WebApplicationContext
|
| Modifier and Type | Method and Description |
|---|---|
T |
alwaysUseMockMvc()
Always use MockMvc no matter what the request looks like.
|
T |
contextPath(java.lang.String contextPath)
The context path to use.
|
protected com.gargoylesoftware.htmlunit.WebConnection |
createConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection)
Creates a new WebConnection that will use a MockMvc instance if one of the
specified WebRequestMatcher matches.
|
T |
useMockMvc(WebRequestMatcher... matchers)
Add additional WebRequestMatcher instances that if return true will ensure MockMvc
is used.
|
T |
useMockMvcForHosts(java.lang.String... hosts)
Add additional WebRequestMatcher instances that will return true if the host matches.
|
protected MockMvcWebConnectionBuilderSupport(org.springframework.test.web.servlet.MockMvc mockMvc)
mockMvc - the MockMvc instance to use. Cannot be null.protected MockMvcWebConnectionBuilderSupport(org.springframework.web.context.WebApplicationContext context)
context - the WebApplicationContext to create a MockMvc instance from.
Cannot be null.protected MockMvcWebConnectionBuilderSupport(org.springframework.web.context.WebApplicationContext context,
org.springframework.test.web.servlet.setup.MockMvcConfigurer configurer)
context - the WebApplicationContext to create a MockMvc instance from.configurer - the MockMvcConfigurer to apply
Cannot be null.public T contextPath(java.lang.String contextPath)
contextPath - the context path to use.public T alwaysUseMockMvc()
public T useMockMvc(WebRequestMatcher... matchers)
matchers - the WebRequestMatcher instances that if true will ensure MockMvc
processes the request.public T useMockMvcForHosts(java.lang.String... hosts)
hosts - the additional hosts that will ensure MockMvc gets invoked (i.e. example.com or example.com:8080).protected final com.gargoylesoftware.htmlunit.WebConnection createConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection)
defaultConnection - the default WebConnection to use if none of the specified
WebRequestMatcher instances match. Cannot be null.alwaysUseMockMvc,
useMockMvc(WebRequestMatcher...),
useMockMvcForHosts(String...)