diff --git a/graphql-dgs/src/test/java/com/alex/graphql/dgs/GraphqlDgsApplicationTests.java b/graphql-dgs/src/test/java/com/alex/graphql/dgs/GraphqlDgsApplicationTests.java index 515b9e8..b025034 100644 --- a/graphql-dgs/src/test/java/com/alex/graphql/dgs/GraphqlDgsApplicationTests.java +++ b/graphql-dgs/src/test/java/com/alex/graphql/dgs/GraphqlDgsApplicationTests.java @@ -32,7 +32,7 @@ class GraphqlDgsApplicationTests { @Test void test_query_all_authors() { - List authorNames = dgsQueryExecutor + List authorNames = this.dgsQueryExecutor .executeAndExtractJsonPath(TestQueries.QUERY_ALL_AUTHORS, TestQueries.JSON_PATH_ALL_AUTHOR_NAMES); validateAuthorNames(authorNames); @@ -40,7 +40,7 @@ void test_query_all_authors() { @Test void test_query_all_posts() { - List titles = dgsQueryExecutor + List titles = this.dgsQueryExecutor .executeAndExtractJsonPath(TestQueries.QUERY_ALL_POSTS, TestQueries.JSON_PATH_ALL_POST_TITLES); validatePostTitles(titles); @@ -48,7 +48,7 @@ void test_query_all_posts() { @Test void test_create_post() { - Post post = dgsQueryExecutor + Post post = this.dgsQueryExecutor .executeAndExtractJsonPathAsObject(TestQueries.MUTATION_CREATE_POST, TestQueries.JSON_PATH_CREATE_POST, Post.class); validateNewPost(post); @@ -56,7 +56,7 @@ void test_create_post() { @Test void test_subscription() { - ExecutionResult executionResult = dgsQueryExecutor.execute(TestQueries.SUBSCRIPTION_GET_RANDOM_POST); + ExecutionResult executionResult = this.dgsQueryExecutor.execute(TestQueries.SUBSCRIPTION_GET_RANDOM_POST); Publisher publisher = executionResult.getData(); StepVerifier.withVirtualTime(() -> publisher, 1) @@ -70,7 +70,7 @@ void test_subscription() { @SuppressWarnings("unchecked") private Post toPost(ExecutionResult result) { Map data = (Map) result.getData(); - return objectMapper.convertValue(data.get("randomPost"), Post.class); + return this.objectMapper.convertValue(data.get("randomPost"), Post.class); } public static void validateAuthorNames(List authorNames) { diff --git a/graphql-kickstart/src/test/java/com/alex/graphql/kickstart/GraphQLKickstartDemoTest.java b/graphql-kickstart/src/test/java/com/alex/graphql/kickstart/GraphQLKickstartDemoTest.java index 8a49147..20b7b1d 100644 --- a/graphql-kickstart/src/test/java/com/alex/graphql/kickstart/GraphQLKickstartDemoTest.java +++ b/graphql-kickstart/src/test/java/com/alex/graphql/kickstart/GraphQLKickstartDemoTest.java @@ -24,7 +24,7 @@ class GraphQLKickstartDemoTest { @Autowired - private GraphQLTestTemplate graphQLTestTemplate; + GraphQLTestTemplate graphQLTestTemplate; @Autowired GraphQLTestSubscription graphQLTestSubscription; @@ -32,7 +32,7 @@ class GraphQLKickstartDemoTest { @Test void test_query_all_authors() throws IOException { - GraphQLResponse response = graphQLTestTemplate.postForString(TestQueries.QUERY_ALL_AUTHORS); + GraphQLResponse response = this.graphQLTestTemplate.postForString(TestQueries.QUERY_ALL_AUTHORS); List authorNames = response.getList(TestQueries.JSON_PATH_ALL_AUTHOR_NAMES, String.class); validateAuthorNames(authorNames); @@ -41,7 +41,7 @@ void test_query_all_authors() throws IOException { @Test void test_query_all_posts() throws IOException { - GraphQLResponse response = graphQLTestTemplate.postForString(TestQueries.QUERY_ALL_POSTS); + GraphQLResponse response = this.graphQLTestTemplate.postForString(TestQueries.QUERY_ALL_POSTS); List titles = response.getList(TestQueries.JSON_PATH_ALL_POST_TITLES, String.class); validatePostTitles(titles); @@ -50,7 +50,7 @@ void test_query_all_posts() throws IOException { @Test void test_create_post() throws IOException { - GraphQLResponse response = graphQLTestTemplate.postForString(TestQueries.MUTATION_CREATE_POST); + GraphQLResponse response = this.graphQLTestTemplate.postForString(TestQueries.MUTATION_CREATE_POST); Post post= response.get(TestQueries.JSON_PATH_CREATE_POST, Post.class); validateNewPost(post); @@ -60,7 +60,7 @@ void test_create_post() throws IOException { void test_subscription() { final GraphQLResponse graphQLResponse = - graphQLTestSubscription + this.graphQLTestSubscription .init() .start("subscription-get-post.graphql") .awaitAndGetNextResponse(Duration.ofSeconds(5)); diff --git a/graphql-spring/src/test/java/com/alex/graphql/spring/GraphqlSpringApplicationTest.java b/graphql-spring/src/test/java/com/alex/graphql/spring/GraphqlSpringApplicationTest.java index 8155251..2615a0d 100644 --- a/graphql-spring/src/test/java/com/alex/graphql/spring/GraphqlSpringApplicationTest.java +++ b/graphql-spring/src/test/java/com/alex/graphql/spring/GraphqlSpringApplicationTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.autoconfigure.graphql.tester.AutoConfigureHttpGraphQlTester; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.graphql.test.tester.GraphQlTester; @@ -23,7 +22,6 @@ import com.alex.graphql.core.util.TestQueries; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@AutoConfigureHttpGraphQlTester @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ActiveProfiles("no-security") public class GraphqlSpringApplicationTest { @@ -37,14 +35,14 @@ public class GraphqlSpringApplicationTest { // testing with reactive client over websocket: @BeforeAll void setUp() { - this.graphQlTester = WebSocketGraphQlTester.builder(URI.create(baseUrl), new ReactorNettyWebSocketClient()) + this.graphQlTester = WebSocketGraphQlTester.builder(URI.create(this.baseUrl), new ReactorNettyWebSocketClient()) .build(); } @Test void test_query_all_authors() throws Exception { - Response response = graphQlTester.document(TestQueries.QUERY_ALL_AUTHORS).execute(); + Response response = this.graphQlTester.document(TestQueries.QUERY_ALL_AUTHORS).execute(); List authorNames = response.path(TestQueries.JSON_PATH_ALL_AUTHOR_NAMES).entityList(String.class).get(); validateAuthorNames(authorNames); @@ -53,7 +51,7 @@ void test_query_all_authors() throws Exception { @Test void test_query_all_posts() throws Exception { - Response response = graphQlTester.document(TestQueries.QUERY_ALL_POSTS).execute(); + Response response = this.graphQlTester.document(TestQueries.QUERY_ALL_POSTS).execute(); List titles = response.path(TestQueries.JSON_PATH_ALL_POST_TITLES).entityList(String.class).get(); validatePostTitles(titles); @@ -62,7 +60,7 @@ void test_query_all_posts() throws Exception { @Test void test_create_post() { - Response response = graphQlTester.document(TestQueries.MUTATION_CREATE_POST).execute(); + Response response = this.graphQlTester.document(TestQueries.MUTATION_CREATE_POST).execute(); Post post = response.path(TestQueries.JSON_PATH_CREATE_POST).entity(Post.class).get(); validateNewPost(post); @@ -71,7 +69,7 @@ void test_create_post() { @Test void test_subscriptions() throws Exception { - Post post = graphQlTester.document(TestQueries.SUBSCRIPTION_GET_RANDOM_POST).executeSubscription() + Post post = this.graphQlTester.document(TestQueries.SUBSCRIPTION_GET_RANDOM_POST).executeSubscription() .toFlux("randomPost", Post.class).blockFirst(); assertThat(post.getTitle()).isEqualTo(TestQueries.BOOK_1_TITLE);