类 MockMvcWebClientBuilder
java.lang.Object
cn.taketoday.test.web.servlet.htmlunit.MockMvcWebConnectionBuilderSupport<MockMvcWebClientBuilder>
cn.taketoday.test.web.servlet.htmlunit.MockMvcWebClientBuilder
public class MockMvcWebClientBuilder
extends MockMvcWebConnectionBuilderSupport<MockMvcWebClientBuilder>
MockMvcWebClientBuilder simplifies the creation of an HtmlUnit
WebClient that delegates to a MockMvc instance.
The MockMvc instance used by the builder may be
supplied directly or created transparently
from a WebApplicationContext.
- 从以下版本开始:
- 4.0
- 作者:
- Rob Winch, Sam Brannen
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器限定符构造器说明protectedMockMvcWebClientBuilder(MockMvc mockMvc) protectedMockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context) protectedMockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) -
方法概要
修饰符和类型方法说明org.htmlunit.WebClientbuild()Build theWebClientconfigured via this builder.static MockMvcWebClientBuildermockMvcSetup(MockMvc mockMvc) Create a newMockMvcWebClientBuilderbased on the suppliedMockMvcinstance.static MockMvcWebClientBuilderwebAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context) Create a newMockMvcWebClientBuilderbased on the suppliedWebApplicationContext.static MockMvcWebClientBuilderwebAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) Create a newMockMvcWebClientBuilderbased on the suppliedWebApplicationContextandMockMvcConfigurer.withDelegate(org.htmlunit.WebClient webClient) 从类继承的方法 cn.taketoday.test.web.servlet.htmlunit.MockMvcWebConnectionBuilderSupport
alwaysUseMockMvc, contextPath, createConnection, useMockMvc, useMockMvcForHosts
-
字段详细资料
-
webClient
@Nullable private org.htmlunit.WebClient webClient
-
-
构造器详细资料
-
MockMvcWebClientBuilder
-
MockMvcWebClientBuilder
protected MockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context) -
MockMvcWebClientBuilder
protected MockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer)
-
-
方法详细资料
-
mockMvcSetup
Create a newMockMvcWebClientBuilderbased on the suppliedMockMvcinstance.- 参数:
mockMvc- theMockMvcinstance to use; nevernull- 返回:
- the MockMvcWebClientBuilder to customize
-
webAppContextSetup
public static MockMvcWebClientBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context) Create a newMockMvcWebClientBuilderbased on the suppliedWebApplicationContext.- 参数:
context- theWebApplicationContextto create aMockMvcinstance from; nevernull- 返回:
- the MockMvcWebClientBuilder to customize
-
webAppContextSetup
public static MockMvcWebClientBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) Create a newMockMvcWebClientBuilderbased on the suppliedWebApplicationContextandMockMvcConfigurer.- 参数:
context- theWebApplicationContextto create aMockMvcinstance from; nevernullconfigurer- theMockMvcConfigurerto apply; nevernull- 返回:
- the MockMvcWebClientBuilder to customize
-
withDelegate
Supply theWebClientthat the client built by this builder should delegate to when processing non-matching requests.- 参数:
webClient- theWebClientto delegate to for requests that do not match; nevernull- 返回:
- this builder for further customization
- 另请参阅:
-
build
public org.htmlunit.WebClient build()Build theWebClientconfigured via this builder.The returned client will use the configured
MockMvcinstance for processing any matching requests and a delegateWebClientfor all other requests.If a delegate has been explicitly configured, it will be used; otherwise, a default
WebClientwill be configured as the delegate.- 返回:
- the
WebClientto use - 另请参阅:
-