Browse Source

Adapt to latest changes in Spring for GraphQL snapshots

See gh-30463
pull/30472/head
Andy Wilkinson 4 years ago
parent
commit
24e6417ddc
  1. 4
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlQueryByExampleAutoConfigurationTests.java
  2. 4
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlQuerydslAutoConfigurationTests.java
  3. 4
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlReactiveQueryByExampleAutoConfigurationTests.java
  4. 4
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlReactiveQuerydslAutoConfigurationTests.java
  5. 2
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc
  6. 6
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/graphql/tester/GraphQlTesterAutoConfiguration.java

4
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlQueryByExampleAutoConfigurationTests.java

@ -30,7 +30,7 @@ import org.springframework.data.repository.CrudRepository; @@ -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 { @@ -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");
});

4
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlQuerydslAutoConfigurationTests.java

@ -30,7 +30,7 @@ import org.springframework.data.querydsl.QuerydslPredicateExecutor; @@ -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 { @@ -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");
});

4
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlReactiveQueryByExampleAutoConfigurationTests.java

@ -29,7 +29,7 @@ import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor; @@ -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 { @@ -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");
});

4
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/data/GraphQlReactiveQuerydslAutoConfigurationTests.java

@ -29,7 +29,7 @@ import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor; @@ -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 { @@ -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");
});

2
spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc

@ -439,7 +439,7 @@ This testing module ships the {spring-graphql-docs}/#testing-graphqltester[Graph @@ -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.

6
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/graphql/tester/GraphQlTesterAutoConfiguration.java

@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean @@ -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 { @@ -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);
}
}

Loading…
Cancel
Save