From 3e8027a0caaae1c7ae25acd8ad1c64e62e8641cf Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 5 Jan 2021 13:12:47 +0100 Subject: [PATCH] Upgrade to Spring Boot 2.4.1 --- spring-graphql-web/build.gradle | 2 +- .../boot/graphql/WebMvcApplicationContextTests.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/spring-graphql-web/build.gradle b/spring-graphql-web/build.gradle index 1795db8e..20c74263 100644 --- a/spring-graphql-web/build.gradle +++ b/spring-graphql-web/build.gradle @@ -1,7 +1,7 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { - id 'org.springframework.boot' version '2.4.0-SNAPSHOT' apply false + id 'org.springframework.boot' version '2.4.1' apply false id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'java-library' id 'maven' diff --git a/spring-graphql-web/src/test/java/org/springframework/boot/graphql/WebMvcApplicationContextTests.java b/spring-graphql-web/src/test/java/org/springframework/boot/graphql/WebMvcApplicationContextTests.java index 7b2ad5d3..75693659 100644 --- a/spring-graphql-web/src/test/java/org/springframework/boot/graphql/WebMvcApplicationContextTests.java +++ b/spring-graphql-web/src/test/java/org/springframework/boot/graphql/WebMvcApplicationContextTests.java @@ -14,11 +14,16 @@ import org.springframework.context.annotation.Configuration; import org.springframework.graphql.GraphQLDataFetchers; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static graphql.schema.idl.TypeRuntimeWiring.newTypeWiring; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -40,8 +45,10 @@ class WebMvcApplicationContextTests { " author" + " }" + "}"; - mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")) + MvcResult asyncResult = mockMvc.perform(post("/graphql").content("{\"query\": \"" + query + "\"}")).andReturn(); + mockMvc.perform(asyncDispatch(asyncResult)) .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("data.bookById.name").value("GraphQL for beginners")); }); } @@ -65,7 +72,7 @@ class WebMvcApplicationContextTests { "spring.main.web-application-type=servlet", "spring.graphql.schema-location:classpath:books/schema.graphqls") .run((context) -> { - MockHttpServletRequestBuilder builder = post("/graphQL") + MockHttpServletRequestBuilder builder = post("/graphql") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON); MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).defaultRequest(builder).build();