Adapt to latest changes in Spring for GraphQL snapshots
See gh-30463
This commit is contained in:
@@ -30,7 +30,7 @@ import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.graphql.data.GraphQlRepository;
|
||||
import org.springframework.graphql.test.tester.GraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
@@ -55,7 +55,7 @@ class GraphQlQueryByExampleAutoConfigurationTests {
|
||||
void shouldRegisterDataFetcherForQueryByExampleRepositories() {
|
||||
this.contextRunner.run((context) -> {
|
||||
ExecutionGraphQlService graphQlService = context.getBean(ExecutionGraphQlService.class);
|
||||
GraphQlServiceTester graphQlTester = GraphQlServiceTester.create(graphQlService);
|
||||
ExecutionGraphQlServiceTester graphQlTester = ExecutionGraphQlServiceTester.create(graphQlService);
|
||||
graphQlTester.document("{ bookById(id: 1) {name}}").execute().path("bookById.name").entity(String.class)
|
||||
.isEqualTo("Test title");
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.graphql.data.GraphQlRepository;
|
||||
import org.springframework.graphql.test.tester.GraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.GraphQlTester;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -56,7 +56,7 @@ class GraphQlQuerydslAutoConfigurationTests {
|
||||
void shouldRegisterDataFetcherForQueryDslRepositories() {
|
||||
this.contextRunner.run((context) -> {
|
||||
ExecutionGraphQlService graphQlService = context.getBean(ExecutionGraphQlService.class);
|
||||
GraphQlTester graphQlTester = GraphQlServiceTester.create(graphQlService);
|
||||
GraphQlTester graphQlTester = ExecutionGraphQlServiceTester.create(graphQlService);
|
||||
graphQlTester.document("{ bookById(id: 1) {name}}").execute().path("bookById.name").entity(String.class)
|
||||
.isEqualTo("Test title");
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor;
|
||||
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.graphql.data.GraphQlRepository;
|
||||
import org.springframework.graphql.test.tester.GraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.GraphQlTester;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -55,7 +55,7 @@ class GraphQlReactiveQueryByExampleAutoConfigurationTests {
|
||||
void shouldRegisterDataFetcherForQueryByExampleRepositories() {
|
||||
this.contextRunner.run((context) -> {
|
||||
ExecutionGraphQlService graphQlService = context.getBean(ExecutionGraphQlService.class);
|
||||
GraphQlTester graphQlTester = GraphQlServiceTester.create(graphQlService);
|
||||
GraphQlTester graphQlTester = ExecutionGraphQlServiceTester.create(graphQlService);
|
||||
graphQlTester.document("{ bookById(id: 1) {name}}").execute().path("bookById.name").entity(String.class)
|
||||
.isEqualTo("Test title");
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor;
|
||||
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.graphql.data.GraphQlRepository;
|
||||
import org.springframework.graphql.test.tester.GraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.GraphQlTester;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -55,7 +55,7 @@ class GraphQlReactiveQuerydslAutoConfigurationTests {
|
||||
void shouldRegisterDataFetcherForQueryDslRepositories() {
|
||||
this.contextRunner.run((context) -> {
|
||||
ExecutionGraphQlService graphQlService = context.getBean(ExecutionGraphQlService.class);
|
||||
GraphQlTester graphQlTester = GraphQlServiceTester.create(graphQlService);
|
||||
GraphQlTester graphQlTester = ExecutionGraphQlServiceTester.create(graphQlService);
|
||||
graphQlTester.document("{ bookById(id: 1) {name}}").execute().path("bookById.name").entity(String.class)
|
||||
.isEqualTo("Test title");
|
||||
});
|
||||
|
||||
@@ -439,7 +439,7 @@ This testing module ships the {spring-graphql-docs}/#testing-graphqltester[Graph
|
||||
The tester is heavily used in test, so be sure to become familiar with using it.
|
||||
There are `GraphQlTester` variants and Spring Boot will auto-configure them depending on the type of tests:
|
||||
|
||||
* the `GraphQlServiceTester` performs tests on the server side, without a client nor a transport
|
||||
* the `ExecutionGraphQlServiceTester` performs tests on the server side, without a client nor a transport
|
||||
* the `HttpGraphQlTester` performs tests with a client that connects to a server, with or without a live server
|
||||
|
||||
Spring Boot helps you to test your {spring-graphql-docs}#controllers[Spring GraphQL Controllers] with the `@GraphQlTest` annotation.
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.graphql.test.tester.GraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
|
||||
import org.springframework.graphql.test.tester.GraphQlTester;
|
||||
|
||||
/**
|
||||
@@ -41,8 +41,8 @@ public class GraphQlTesterAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnBean(ExecutionGraphQlService.class)
|
||||
@ConditionalOnMissingBean
|
||||
public GraphQlServiceTester graphQlTester(ExecutionGraphQlService graphQlService) {
|
||||
return GraphQlServiceTester.create(graphQlService);
|
||||
public ExecutionGraphQlServiceTester graphQlTester(ExecutionGraphQlService graphQlService) {
|
||||
return ExecutionGraphQlServiceTester.create(graphQlService);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user