Search in sources :

Example 36 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.

the class BasicErrorControllerDirectMockMvcTests method errorPageAvailableWithParentContext.

@Test
public void errorPageAvailableWithParentContext() throws Exception {
    setup((ConfigurableWebApplicationContext) new SpringApplicationBuilder(ParentConfiguration.class).child(ChildConfiguration.class).run("--server.port=0"));
    MvcResult response = this.mockMvc.perform(get("/error").accept(MediaType.TEXT_HTML)).andExpect(status().is5xxServerError()).andReturn();
    String content = response.getResponse().getContentAsString();
    assertThat(content).contains("status=999");
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) MvcResult(org.springframework.test.web.servlet.MvcResult) Test(org.junit.Test)

Aggregations

SpringApplicationBuilder (org.springframework.boot.builder.SpringApplicationBuilder)36 Test (org.junit.Test)32 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)17 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)13 DefaultTokenServices (org.springframework.security.oauth2.provider.token.DefaultTokenServices)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 URI (java.net.URI)1 RoutesCollector (org.apache.camel.spring.boot.RoutesCollector)1 Logger (org.slf4j.Logger)1 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)1 BeanDefinitionRegistry (org.springframework.beans.factory.support.BeanDefinitionRegistry)1 Banner (org.springframework.boot.Banner)1 SpringApplication (org.springframework.boot.SpringApplication)1 JmxAutoConfiguration (org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration)1 ParentContextApplicationContextInitializer (org.springframework.boot.builder.ParentContextApplicationContextInitializer)1 ApplicationStartingEvent (org.springframework.boot.context.event.ApplicationStartingEvent)1 ServerPortInfoApplicationContextInitializer (org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer)1 AnnotationConfigServletWebServerApplicationContext (org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ApplicationListener (org.springframework.context.ApplicationListener)1