File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
spring-boot-project/spring-boot-test/src
main/java/org/springframework/boot/test/context
test/java/org/springframework/boot/test/context Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 23
23
24
24
import org .springframework .beans .BeanUtils ;
25
25
import org .springframework .boot .ApplicationContextFactory ;
26
+ import org .springframework .boot .Banner .Mode ;
26
27
import org .springframework .boot .DefaultPropertiesPropertySource ;
27
28
import org .springframework .boot .SpringApplication ;
28
29
import org .springframework .boot .WebApplicationType ;
@@ -129,6 +130,9 @@ else if (type == WebApplicationType.SERVLET) {
129
130
}
130
131
return ApplicationContextFactory .DEFAULT .create (type );
131
132
});
133
+ if (config .getParent () != null ) {
134
+ application .setBannerMode (Mode .OFF );
135
+ }
132
136
application .setInitializers (initializers );
133
137
boolean customEnvironent = ReflectionUtils .findMethod (getClass (), "getEnvironment" )
134
138
.getDeclaringClass () != SpringBootContextLoader .class ;
Original file line number Diff line number Diff line change 17
17
package org .springframework .boot .test .context ;
18
18
19
19
import org .junit .jupiter .api .Test ;
20
+ import org .junit .jupiter .api .extension .ExtendWith ;
20
21
21
22
import org .springframework .boot .test .context .SpringBootTestContextHierarchyTests .ChildConfiguration ;
22
23
import org .springframework .boot .test .context .SpringBootTestContextHierarchyTests .ParentConfiguration ;
24
+ import org .springframework .boot .test .system .CapturedOutput ;
25
+ import org .springframework .boot .test .system .OutputCaptureExtension ;
23
26
import org .springframework .context .annotation .Bean ;
24
27
import org .springframework .context .annotation .Configuration ;
25
28
import org .springframework .test .context .ContextConfiguration ;
26
29
import org .springframework .test .context .ContextHierarchy ;
27
30
31
+ import static org .assertj .core .api .Assertions .assertThat ;
32
+
28
33
/**
29
34
* Tests for {@link SpringBootTest @SpringBootTest} and
30
35
* {@link ContextHierarchy @ContextHierarchy}.
34
39
@ SpringBootTest
35
40
@ ContextHierarchy ({ @ ContextConfiguration (classes = ParentConfiguration .class ),
36
41
@ ContextConfiguration (classes = ChildConfiguration .class ) })
42
+ @ ExtendWith (OutputCaptureExtension .class )
37
43
class SpringBootTestContextHierarchyTests {
38
44
39
45
@ Test
40
- void contextLoads () {
41
-
46
+ void contextLoads (CapturedOutput capturedOutput ) {
47
+ assertThat ( capturedOutput ). containsOnlyOnce ( ":: Spring Boot ::" );
42
48
}
43
49
44
50
@ Configuration (proxyBeanMethods = false )
You can’t perform that action at this time.
0 commit comments