mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Fix property prefix
This commit fixes the prefix for the WebClient and WebDriver auto-config so that it complies with the prefix set on `AutoconfigureWebMvc` Closes gh-6727
This commit is contained in:
parent
5a1741e2e8
commit
2c61064d93
@ -39,7 +39,7 @@ import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder;
|
||||
@Configuration
|
||||
@ConditionalOnClass(WebClient.class)
|
||||
@AutoConfigureAfter(MockMvcAutoConfiguration.class)
|
||||
@ConditionalOnProperty(prefix = "spring.test.webmvc.webclient", name = "enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(prefix = "spring.test.mockmvc.webclient", name = "enabled", matchIfMissing = true)
|
||||
public class MockMvcWebClientAutoConfiguration {
|
||||
|
||||
private final Environment environment;
|
||||
|
@ -41,7 +41,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@Configuration
|
||||
@ConditionalOnClass(HtmlUnitDriver.class)
|
||||
@AutoConfigureAfter(MockMvcAutoConfiguration.class)
|
||||
@ConditionalOnProperty(prefix = "spring.test.webmvc.webdriver", name = "enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(prefix = "spring.test.mockmvc.webdriver", name = "enabled", matchIfMissing = true)
|
||||
public class MockMvcWebDriverAutoConfiguration {
|
||||
|
||||
private final Environment environment;
|
||||
|
@ -17,10 +17,13 @@
|
||||
package org.springframework.boot.test.autoconfigure.web.servlet;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@ -33,12 +36,16 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
* Tests for {@link WebMvcTest} with {@link AutoConfigureMockMvc}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest
|
||||
@AutoConfigureMockMvc(addFilters = false, webClientEnabled = false, webDriverEnabled = false)
|
||||
public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@ -52,11 +59,13 @@ public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveWebDriver() throws Exception {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.context.getBean(WebDriver.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveWebClient() throws Exception {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.context.getBean(WebClient.class);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user