类 MockMvcHtmlUnitDriverBuilder
java.lang.Object
cn.taketoday.test.web.servlet.htmlunit.MockMvcWebConnectionBuilderSupport<MockMvcHtmlUnitDriverBuilder>
cn.taketoday.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder
public class MockMvcHtmlUnitDriverBuilder
extends MockMvcWebConnectionBuilderSupport<MockMvcHtmlUnitDriverBuilder>
MockMvcHtmlUnitDriverBuilder simplifies the building of an
HtmlUnitDriver that delegates to MockMvc and optionally
delegates to an actual connection for specific requests.
By default, the driver will delegate to MockMvc to handle
requests to localhost and to a WebClient to handle any
other URL (i.e. to perform an actual HTTP request).
- 从以下版本开始:
- 4.0
- 作者:
- Rob Winch, Sam Brannen
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private org.openqa.selenium.htmlunit.HtmlUnitDriverprivate boolean -
构造器概要
构造器限定符构造器说明protectedMockMvcHtmlUnitDriverBuilder(MockMvc mockMvc) protectedMockMvcHtmlUnitDriverBuilder(cn.taketoday.web.servlet.WebApplicationContext context) protectedMockMvcHtmlUnitDriverBuilder(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) -
方法概要
修饰符和类型方法说明org.openqa.selenium.htmlunit.HtmlUnitDriverbuild()Build theHtmlUnitDriverconfigured via this builder.javascriptEnabled(boolean javascriptEnabled) Specify whether JavaScript should be enabled.static MockMvcHtmlUnitDriverBuildermockMvcSetup(MockMvc mockMvc) Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedMockMvcinstance.static MockMvcHtmlUnitDriverBuilderwebAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context) Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedWebApplicationContext.static MockMvcHtmlUnitDriverBuilderwebAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedWebApplicationContextandMockMvcConfigurer.从类继承的方法 cn.taketoday.test.web.servlet.htmlunit.MockMvcWebConnectionBuilderSupport
alwaysUseMockMvc, contextPath, createConnection, useMockMvc, useMockMvcForHosts
-
字段详细资料
-
driver
@Nullable private org.openqa.selenium.htmlunit.HtmlUnitDriver driver -
javascriptEnabled
private boolean javascriptEnabled
-
-
构造器详细资料
-
MockMvcHtmlUnitDriverBuilder
-
MockMvcHtmlUnitDriverBuilder
protected MockMvcHtmlUnitDriverBuilder(cn.taketoday.web.servlet.WebApplicationContext context) -
MockMvcHtmlUnitDriverBuilder
protected MockMvcHtmlUnitDriverBuilder(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer)
-
-
方法详细资料
-
mockMvcSetup
Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedMockMvcinstance.- 参数:
mockMvc- theMockMvcinstance to use (nevernull)- 返回:
- the MockMvcHtmlUnitDriverBuilder to customize
-
webAppContextSetup
public static MockMvcHtmlUnitDriverBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context) Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedWebApplicationContext.- 参数:
context- theWebApplicationContextto create aMockMvcinstance from (nevernull)- 返回:
- the MockMvcHtmlUnitDriverBuilder to customize
-
webAppContextSetup
public static MockMvcHtmlUnitDriverBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer) Create a newMockMvcHtmlUnitDriverBuilderbased on the suppliedWebApplicationContextandMockMvcConfigurer.- 参数:
context- theWebApplicationContextto create aMockMvcinstance from (nevernull)configurer- theMockMvcConfigurerto apply (nevernull)- 返回:
- the MockMvcHtmlUnitDriverBuilder to customize
-
javascriptEnabled
Specify whether JavaScript should be enabled.Default is
true.- 参数:
javascriptEnabled-trueif JavaScript should be enabled- 返回:
- this builder for further customizations
- 另请参阅:
-
withDelegate
Supply theWebConnectionHtmlUnitDriverthat the driver built by this builder should delegate to when processing non-matching requests.- 参数:
driver- theWebConnectionHtmlUnitDriverto delegate to for requests that do not match (nevernull)- 返回:
- this builder for further customizations
- 另请参阅:
-
build
public org.openqa.selenium.htmlunit.HtmlUnitDriver build()Build theHtmlUnitDriverconfigured via this builder.The returned driver will use the configured
MockMvcinstance for processing any matching requests and a delegateHtmlUnitDriverfor all other requests.If a delegate has been explicitly configured, it will be used; otherwise, a default
WebConnectionHtmlUnitDriverwith theBrowserVersionset toCHROMEwill be configured as the delegate.- 返回:
- the
HtmlUnitDriverto use - 另请参阅:
-