Skip to content

Commit

Permalink
Merge branch '2.6.x' into 2.7.x
Browse files Browse the repository at this point in the history
Closes gh-33262
  • Loading branch information
wilkinsona committed Nov 18, 2022
2 parents 2cee6a8 + 0c8ae65 commit 6bf35e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Expand Up @@ -22,6 +22,7 @@

import org.springframework.beans.BeanUtils;
import org.springframework.boot.ApplicationContextFactory;
import org.springframework.boot.Banner.Mode;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
Expand Down Expand Up @@ -119,6 +120,9 @@ else if (type == WebApplicationType.SERVLET) {
}
return ApplicationContextFactory.DEFAULT.create(type);
});
if (config.getParent() != null) {
application.setBannerMode(Mode.OFF);
}
application.setInitializers(initializers);
ConfigurableEnvironment environment = getEnvironment();
if (environment != null) {
Expand Down
Expand Up @@ -17,14 +17,19 @@
package org.springframework.boot.test.context;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.springframework.boot.test.context.SpringBootTestContextHierarchyTests.ChildConfiguration;
import org.springframework.boot.test.context.SpringBootTestContextHierarchyTests.ParentConfiguration;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextHierarchy;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Tests for {@link SpringBootTest @SpringBootTest} and
* {@link ContextHierarchy @ContextHierarchy}.
Expand All @@ -34,11 +39,12 @@
@SpringBootTest
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfiguration.class),
@ContextConfiguration(classes = ChildConfiguration.class) })
@ExtendWith(OutputCaptureExtension.class)
class SpringBootTestContextHierarchyTests {

@Test
void contextLoads() {

void contextLoads(CapturedOutput capturedOutput) {
assertThat(capturedOutput).containsOnlyOnce(":: Spring Boot ::");
}

@Configuration(proxyBeanMethods = false)
Expand Down

0 comments on commit 6bf35e3

Please sign in to comment.