|
17 | 17 | package org.springframework.boot.autoconfigure.graphql.servlet;
|
18 | 18 |
|
19 | 19 | import graphql.schema.idl.TypeRuntimeWiring;
|
| 20 | +import org.hamcrest.Matchers; |
20 | 21 | import org.junit.jupiter.api.Test;
|
21 | 22 |
|
22 | 23 | import org.springframework.boot.autoconfigure.AutoConfigurations;
|
@@ -56,8 +57,8 @@ class GraphQlWebMvcAutoConfigurationTests {
|
56 | 57 | AutoConfigurations.of(DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
57 | 58 | HttpMessageConvertersAutoConfiguration.class, JacksonAutoConfiguration.class,
|
58 | 59 | GraphQlAutoConfiguration.class, GraphQlWebMvcAutoConfiguration.class))
|
59 |
| - .withUserConfiguration(DataFetchersConfiguration.class, CustomWebInterceptor.class) |
60 |
| - .withPropertyValues("spring.main.web-application-type=servlet"); |
| 60 | + .withUserConfiguration(DataFetchersConfiguration.class, CustomWebInterceptor.class).withPropertyValues( |
| 61 | + "spring.main.web-application-type=servlet", "spring.graphql.schema.printer.enabled=true"); |
61 | 62 |
|
62 | 63 | @Test
|
63 | 64 | void simpleQueryShouldWork() {
|
@@ -99,6 +100,13 @@ void shouldConfigureWebInterceptors() {
|
99 | 100 | });
|
100 | 101 | }
|
101 | 102 |
|
| 103 | + @Test |
| 104 | + void shouldExposeSchemaEndpoint() { |
| 105 | + testWith((mockMvc) -> mockMvc.perform(get("/graphql/schema")).andExpect(status().isOk()) |
| 106 | + .andExpect(content().contentType(MediaType.TEXT_PLAIN)) |
| 107 | + .andExpect(content().string(Matchers.containsString("type Book")))); |
| 108 | + } |
| 109 | + |
102 | 110 | private void testWith(MockMvcConsumer mockMvcConsumer) {
|
103 | 111 | this.contextRunner.run((context) -> {
|
104 | 112 | MediaType mediaType = MediaType.APPLICATION_JSON;
|
|
0 commit comments