Skip to content

Commit eeddb43

Browse files
committed
project review
1 parent a3be58e commit eeddb43

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app18/SpringDocApp18Test.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,25 @@
1919
package test.org.springdoc.ui.app18;
2020

2121
import org.junit.jupiter.api.Test;
22-
import org.skyscreamer.jsonassert.JSONAssert;
22+
import test.org.springdoc.ui.AbstractSpringDocTest;
23+
2324
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+
}
4341

4442
@SpringBootApplication
4543
static class SpringDocTestApp {

0 commit comments

Comments
 (0)