@ -17,10 +17,13 @@
package org.springframework.boot.test.autoconfigure.web.servlet ;
package org.springframework.boot.test.autoconfigure.web.servlet ;
import com.gargoylesoftware.htmlunit.WebClient ;
import com.gargoylesoftware.htmlunit.WebClient ;
import org.junit.Rule ;
import org.junit.Test ;
import org.junit.Test ;
import org.junit.rules.ExpectedException ;
import org.junit.runner.RunWith ;
import org.junit.runner.RunWith ;
import org.openqa.selenium.WebDriver ;
import org.openqa.selenium.WebDriver ;
import org.springframework.beans.factory.NoSuchBeanDefinitionException ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.context.ApplicationContext ;
import org.springframework.context.ApplicationContext ;
import org.springframework.test.context.junit4.SpringRunner ;
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 } .
* Tests for { @link WebMvcTest } with { @link AutoConfigureMockMvc } .
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Stephane Nicoll
* /
* /
@RunWith ( SpringRunner . class )
@RunWith ( SpringRunner . class )
@WebMvcTest
@WebMvcTest
@AutoConfigureMockMvc ( addFilters = false , webClientEnabled = false , webDriverEnabled = false )
@AutoConfigureMockMvc ( addFilters = false , webClientEnabled = false , webDriverEnabled = false )
public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
@Rule
public ExpectedException thrown = ExpectedException . none ( ) ;
@Autowired
@Autowired
private ApplicationContext context ;
private ApplicationContext context ;
@ -52,11 +59,13 @@ public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
@Test
@Test
public void shouldNotHaveWebDriver ( ) throws Exception {
public void shouldNotHaveWebDriver ( ) throws Exception {
this . thrown . expect ( NoSuchBeanDefinitionException . class ) ;
this . context . getBean ( WebDriver . class ) ;
this . context . getBean ( WebDriver . class ) ;
}
}
@Test
@Test
public void shouldNotHaveWebClient ( ) throws Exception {
public void shouldNotHaveWebClient ( ) throws Exception {
this . thrown . expect ( NoSuchBeanDefinitionException . class ) ;
this . context . getBean ( WebClient . class ) ;
this . context . getBean ( WebClient . class ) ;
}
}