|
19 | 19 | package test.org.springdoc.ui.app18;
|
20 | 20 |
|
21 | 21 | import org.junit.jupiter.api.Test;
|
22 |
| -import org.skyscreamer.jsonassert.JSONAssert; |
| 22 | +import test.org.springdoc.ui.AbstractSpringDocTest; |
| 23 | + |
23 | 24 | import org.springframework.boot.autoconfigure.SpringBootApplication;
|
24 |
| -import org.springframework.boot.test.context.SpringBootTest; |
25 |
| -import test.org.springdoc.ui.AbstractSpringDocActuatorTest; |
26 |
| - |
27 |
| -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, |
28 |
| - properties = {"management.endpoints.web.exposure.include:*", |
29 |
| - "springdoc.use-management-port=true", |
30 |
| - "springdoc.swagger-ui.try-it-out-enabled=true", |
31 |
| - "management.server.port=9095", |
32 |
| - "management.server.base-path=/test", |
33 |
| - "management.endpoints.web.base-path=/application" |
34 |
| - }) |
35 |
| -class SpringDocApp18Test extends AbstractSpringDocActuatorTest { |
36 |
| - |
37 |
| - @Test |
38 |
| - public void testIndexSwaggerConfigTryItOutEnabledExists() throws Exception { |
39 |
| - String contentAsString = actuatorRestTemplate.getForObject("/test/application/swaggerui/swagger-config", String.class); |
40 |
| - String expected = getContent("results/app18-1.json"); |
41 |
| - JSONAssert.assertEquals(expected, contentAsString, true); |
42 |
| - } |
| 25 | +import org.springframework.test.context.TestPropertySource; |
| 26 | + |
| 27 | +import static org.hamcrest.CoreMatchers.equalTo; |
| 28 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
| 29 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; |
| 30 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
| 31 | + |
| 32 | +@TestPropertySource(properties = "springdoc.swagger-ui.try-it-out-enabled=true" ) |
| 33 | +public class SpringDocApp18Test extends AbstractSpringDocTest { |
| 34 | + |
| 35 | + @Test |
| 36 | + public void testTryItOutEnabled() throws Exception { |
| 37 | + mockMvc.perform(get("/v3/api-docs/swagger-config")) |
| 38 | + .andExpect(status().isOk()) |
| 39 | + .andExpect(jsonPath("tryItOutEnabled", equalTo("true"))); |
| 40 | + } |
43 | 41 |
|
44 | 42 | @SpringBootApplication
|
45 | 43 | static class SpringDocTestApp {
|
|
0 commit comments