File tree Expand file tree Collapse file tree
springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package test .org .springdoc .api .v30 .app245 ;
2+
3+ import org .junit .jupiter .api .Test ;
4+ import org .springdoc .core .models .GroupedOpenApi ;
5+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6+ import org .springframework .boot .test .context .runner .WebApplicationContextRunner ;
7+ import org .springframework .context .annotation .Bean ;
8+
9+ import static org .assertj .core .api .Assertions .assertThat ;
10+
11+ public class SpringDocApp245Test {
12+
13+ private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner ()
14+ .withUserConfiguration (TestApp .class );
15+
16+ @ Test
17+ void configurations_successfully_loaded_without_embedded_server () {
18+ // Exclude WebServers AutoConfiguration to simulate WAR deployment
19+ contextRunner
20+ .withPropertyValues (
21+ "spring.autoconfigure.exclude=" +
22+ "org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration," +
23+ "org.springframework.boot.jetty.autoconfigure.servlet.JettyServletWebServerAutoConfiguration" ,
24+ "springdoc.show-actuator=true"
25+ )
26+ .run (context -> assertThat (context )
27+ .hasNotFailed ()
28+ .hasBean ("openApiResource" )
29+ .hasBean ("actuatorProvider" )
30+ .hasBean ("multipleOpenApiResource" )
31+ );
32+ }
33+
34+ @ SpringBootApplication
35+ static class TestApp {
36+ @ Bean
37+ GroupedOpenApi testGroupedOpenApi () {
38+ return GroupedOpenApi .builder ()
39+ .group ("test-group" )
40+ .packagesToScan ("org.test" )
41+ .build ();
42+ }
43+ }
44+
45+ }
Original file line number Diff line number Diff line change 1+ package test .org .springdoc .api .v31 .app253 ;
2+ import org .junit .jupiter .api .Test ;
3+ import org .springdoc .core .models .GroupedOpenApi ;
4+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+ import org .springframework .boot .test .context .runner .WebApplicationContextRunner ;
6+ import org .springframework .context .annotation .Bean ;
7+
8+ import static org .assertj .core .api .Assertions .assertThat ;
9+ public class SpringDocApp253Test {
10+ private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner ()
11+ .withUserConfiguration (TestApp .class );
12+
13+ @ Test
14+ void configurations_successfully_loaded_without_embedded_server () {
15+ // Exclude WebServers AutoConfiguration to simulate WAR deployment
16+ contextRunner
17+ .withPropertyValues (
18+ "spring.autoconfigure.exclude=" +
19+ "org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration," +
20+ "org.springframework.boot.jetty.autoconfigure.servlet.JettyServletWebServerAutoConfiguration" ,
21+ "springdoc.show-actuator=true"
22+ )
23+ .run (context -> assertThat (context )
24+ .hasNotFailed ()
25+ .hasBean ("openApiResource" )
26+ .hasBean ("actuatorProvider" )
27+ .hasBean ("multipleOpenApiResource" )
28+ );
29+ }
30+
31+ @ SpringBootApplication
32+ static class TestApp {
33+ @ Bean
34+ GroupedOpenApi testGroupedOpenApi () {
35+ return GroupedOpenApi .builder ()
36+ .group ("test-group" )
37+ .packagesToScan ("org.test" )
38+ .build ();
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments