Replace QL with Ql for consistency with Spring naming
This commit is contained in:
@@ -43,7 +43,7 @@ import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.graphql.RequestInput;
|
||||
import org.springframework.graphql.web.WebGraphQLHandler;
|
||||
import org.springframework.graphql.web.WebGraphQlHandler;
|
||||
import org.springframework.graphql.web.WebInput;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -60,14 +60,14 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link GraphQLTester}.
|
||||
* Default implementation of {@link GraphQlTester}.
|
||||
*/
|
||||
class DefaultGraphQLTester implements GraphQLTester {
|
||||
class DefaultGraphQlTester implements GraphQlTester {
|
||||
|
||||
private static final boolean jackson2Present;
|
||||
|
||||
static {
|
||||
ClassLoader classLoader = DefaultGraphQLTester.class.getClassLoader();
|
||||
ClassLoader classLoader = DefaultGraphQlTester.class.getClassLoader();
|
||||
jackson2Present = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) &&
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader);
|
||||
}
|
||||
@@ -78,12 +78,12 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
private final Configuration jsonPathConfig;
|
||||
|
||||
|
||||
DefaultGraphQLTester(WebTestClient client) {
|
||||
DefaultGraphQlTester(WebTestClient client) {
|
||||
this.jsonPathConfig = initJsonPathConfig();
|
||||
this.requestStrategy = new WebTestClientRequestStrategy(client, this.jsonPathConfig);
|
||||
}
|
||||
|
||||
DefaultGraphQLTester(WebGraphQLHandler handler) {
|
||||
DefaultGraphQlTester(WebGraphQlHandler handler) {
|
||||
this.jsonPathConfig = initJsonPathConfig();
|
||||
this.requestStrategy = new DirectRequestStrategy(handler, this.jsonPathConfig);
|
||||
}
|
||||
@@ -107,12 +107,12 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
/**
|
||||
* Perform a request with the given {@link RequestInput} container.
|
||||
*/
|
||||
GraphQLTester.ResponseSpec execute(RequestInput input);
|
||||
GraphQlTester.ResponseSpec execute(RequestInput input);
|
||||
|
||||
/**
|
||||
* Perform a subscription with the given {@link RequestInput} container.
|
||||
*/
|
||||
GraphQLTester.SubscriptionSpec executeSubscription(RequestInput input);
|
||||
GraphQlTester.SubscriptionSpec executeSubscription(RequestInput input);
|
||||
|
||||
}
|
||||
|
||||
@@ -182,12 +182,12 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(5);
|
||||
|
||||
|
||||
private final WebGraphQLHandler graphQLHandler;
|
||||
private final WebGraphQlHandler graphQlHandler;
|
||||
|
||||
private final Configuration jsonPathConfig;
|
||||
|
||||
public DirectRequestStrategy(WebGraphQLHandler handler, Configuration jsonPathConfig) {
|
||||
this.graphQLHandler = handler;
|
||||
public DirectRequestStrategy(WebGraphQlHandler handler, Configuration jsonPathConfig) {
|
||||
this.graphQlHandler = handler;
|
||||
this.jsonPathConfig = jsonPathConfig;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
|
||||
private ExecutionResult executeInternal(RequestInput input) {
|
||||
WebInput webInput = new WebInput(DEFAULT_URL, DEFAULT_HEADERS, input.toMap(), null);
|
||||
ExecutionResult result = this.graphQLHandler.handle(webInput).block(DEFAULT_TIMEOUT);
|
||||
ExecutionResult result = this.graphQlHandler.handle(webInput).block(DEFAULT_TIMEOUT);
|
||||
Assert.notNull(result, "Expected ExecutionResult");
|
||||
return result;
|
||||
}
|
||||
@@ -269,20 +269,20 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
@Override
|
||||
public ResponseSpec execute() {
|
||||
RequestInput input = new RequestInput(this.query, this.operationName, this.variables);
|
||||
return DefaultGraphQLTester.this.requestStrategy.execute(input);
|
||||
return DefaultGraphQlTester.this.requestStrategy.execute(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeAndVerify() {
|
||||
RequestInput input = new RequestInput(this.query, this.operationName, this.variables);
|
||||
ResponseSpec spec = DefaultGraphQLTester.this.requestStrategy.execute(input);
|
||||
ResponseSpec spec = DefaultGraphQlTester.this.requestStrategy.execute(input);
|
||||
spec.path("$.errors").valueIsEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscriptionSpec executeSubscription() {
|
||||
RequestInput input = new RequestInput(this.query, this.operationName, this.variables);
|
||||
return DefaultGraphQLTester.this.requestStrategy.executeSubscription(input);
|
||||
return DefaultGraphQlTester.this.requestStrategy.executeSubscription(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,11 +291,11 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
|
||||
private static final Predicate<GraphQLError> MATCH_ALL_PREDICATE = error -> true;
|
||||
|
||||
private final List<TestGraphQLError> errors;
|
||||
private final List<TestGraphQlError> errors;
|
||||
|
||||
private final Consumer<Runnable> assertDecorator;
|
||||
|
||||
ErrorsContainer(List<TestGraphQLError> errors, Consumer<Runnable> assertDecorator) {
|
||||
ErrorsContainer(List<TestGraphQlError> errors, Consumer<Runnable> assertDecorator) {
|
||||
Assert.notNull(errors, "`errors` is required");
|
||||
Assert.notNull(assertDecorator, "`assertDecorator` is required");
|
||||
this.errors = errors;
|
||||
@@ -317,7 +317,7 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
|
||||
public void verifyErrors() {
|
||||
|
||||
List<TestGraphQLError> unexpected =
|
||||
List<TestGraphQlError> unexpected =
|
||||
this.errors.stream().filter(error -> !error.isExpected()).collect(Collectors.toList());
|
||||
|
||||
this.assertDecorator.accept(() -> AssertionErrors.assertTrue(
|
||||
@@ -346,10 +346,10 @@ class DefaultGraphQLTester implements GraphQLTester {
|
||||
this.jsonContent = this.documentContext.jsonString();
|
||||
}
|
||||
|
||||
private static List<TestGraphQLError> readErrors(DocumentContext documentContext) {
|
||||
private static List<TestGraphQlError> readErrors(DocumentContext documentContext) {
|
||||
Assert.notNull(documentContext, "DocumentContext is required");
|
||||
try {
|
||||
return documentContext.read(ERRORS_PATH, new TypeRef<List<TestGraphQLError>>() {});
|
||||
return documentContext.read(ERRORS_PATH, new TypeRef<List<TestGraphQlError>>() {});
|
||||
}
|
||||
catch (PathNotFoundException ex) {
|
||||
return Collections.emptyList();
|
||||
@@ -24,14 +24,14 @@ import graphql.GraphQLError;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.graphql.web.WebGraphQLHandler;
|
||||
import org.springframework.graphql.web.WebGraphQlHandler;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* Main entry point for testing GraphQL with requests performed either as an
|
||||
* HTTP client via {@link WebTestClient} or directly via a
|
||||
* {@link WebGraphQLHandler}.
|
||||
* {@link WebGraphQlHandler}.
|
||||
*
|
||||
*
|
||||
* <p>GraphQL requests to Spring MVC without an HTTP server:
|
||||
@@ -40,12 +40,12 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* @AutoConfigureMockMvc
|
||||
* public class MyTests {
|
||||
*
|
||||
* private GraphQLTester graphQLTester;
|
||||
* private GraphQlTester graphQlTester;
|
||||
*
|
||||
* @BeforeEach
|
||||
* public void setUp(@Autowired MockMvc mockMvc) {
|
||||
* WebTestClient client = MockMvcWebTestClient.bindTo(mockMvc).baseUrl("/graphql").build();
|
||||
* this.graphQLTester = GraphQLTester.create(client);
|
||||
* this.graphQlTester = GraphQlTester.create(client);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
@@ -55,11 +55,11 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* @AutoConfigureWebTestClient
|
||||
* public class MyTests {
|
||||
*
|
||||
* private GraphQLTester graphQLTester;
|
||||
* private GraphQlTester graphQlTester;
|
||||
*
|
||||
* @BeforeEach
|
||||
* public void setUp(@Autowired WebTestClient client) {
|
||||
* this.graphQLTester = GraphQLTester.create(client);
|
||||
* this.graphQlTester = GraphQlTester.create(client);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
@@ -68,28 +68,28 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
* public class MyTests {
|
||||
*
|
||||
* private GraphQLTester graphQLTester;
|
||||
* private GraphQlTester graphQlTester;
|
||||
*
|
||||
* @BeforeEach
|
||||
* public void setUp(@Autowired WebTestClient client) {
|
||||
* this.graphQLTester = GraphQLTester.create(client);
|
||||
* this.graphQlTester = GraphQlTester.create(client);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>GraphQL requests to any {@link WebGraphQLHandler}:
|
||||
* <p>GraphQL requests to any {@link WebGraphQlHandler}:
|
||||
* <pre class="code">
|
||||
* @SpringBootTest
|
||||
* public class MyTests {
|
||||
*
|
||||
* private GraphQLTester graphQLTester;
|
||||
* private GraphQlTester graphQlTester;
|
||||
*
|
||||
* @BeforeEach
|
||||
* public void setUp(@Autowired WebGraphQLHandler handler) {
|
||||
* this.graphQLTester = GraphQLTester.create(handler);
|
||||
* this.graphQlTester = GraphQlTester.create(handler);
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public interface GraphQLTester {
|
||||
public interface GraphQlTester {
|
||||
|
||||
/**
|
||||
* Prepare to perform a GraphQL request with the given operation which may
|
||||
@@ -102,25 +102,25 @@ public interface GraphQLTester {
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@code GraphQLTester} that performs GraphQL requests as an HTTP
|
||||
* Create a {@code GraphQlTester} that performs GraphQL requests as an HTTP
|
||||
* client through the given {@link WebTestClient}. Depending on how the
|
||||
* {@code WebTestClient} is set up, tests may be with or without a server.
|
||||
* See setup examples in class-level Javadoc.
|
||||
* @param client the web client to perform requests with
|
||||
* @return the created {@code GraphQLTester} instance
|
||||
* @return the created {@code GraphQlTester} instance
|
||||
*/
|
||||
static GraphQLTester create(WebTestClient client) {
|
||||
return new DefaultGraphQLTester(client);
|
||||
static GraphQlTester create(WebTestClient client) {
|
||||
return new DefaultGraphQlTester(client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code GraphQLTester} that performs GraphQL requests through
|
||||
* the given {@link WebGraphQLHandler}.
|
||||
* Create a {@code GraphQlTester} that performs GraphQL requests through
|
||||
* the given {@link WebGraphQlHandler}.
|
||||
* @param handler the handler to execute requests with
|
||||
* @return the created {@code GraphQLTester} instance
|
||||
* @return the created {@code GraphQlTester} instance
|
||||
*/
|
||||
static GraphQLTester create(WebGraphQLHandler handler) {
|
||||
return new DefaultGraphQLTester(handler);
|
||||
static GraphQlTester create(WebGraphQlHandler handler) {
|
||||
return new DefaultGraphQlTester(handler);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TestExecutionResult implements ExecutionResult {
|
||||
return (T) this.data;
|
||||
}
|
||||
|
||||
public void setErrors(List<TestGraphQLError> errors) {
|
||||
public void setErrors(List<TestGraphQlError> errors) {
|
||||
this.errors = new ArrayList<>(errors);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import graphql.language.SourceLocation;
|
||||
/**
|
||||
* {@link GraphQLError} with setters to use for deserialization.
|
||||
*/
|
||||
class TestGraphQLError implements GraphQLError {
|
||||
class TestGraphQlError implements GraphQLError {
|
||||
|
||||
private String message;
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.mockito.ArgumentCaptor;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.graphql.web.WebGraphQLHandler;
|
||||
import org.springframework.graphql.web.WebGraphQlHandler;
|
||||
import org.springframework.graphql.web.WebInput;
|
||||
import org.springframework.graphql.web.WebOutput;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -55,34 +55,34 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Tests for {@link GraphQLTester} parameterized to:
|
||||
* Tests for {@link GraphQlTester} parameterized to:
|
||||
* <ul>
|
||||
* <li>Connect to {@link MockWebServer} and return a preset HTTP response.
|
||||
* <li>Use mock {@link WebGraphQLHandler} to return a preset {@link ExecutionResult}.
|
||||
* <li>Use mock {@link WebGraphQlHandler} to return a preset {@link ExecutionResult}.
|
||||
* </ul>
|
||||
*
|
||||
* <p>There is no actual handling via {@link graphql.GraphQL} in either scenario.
|
||||
* The main focus is to verify {@link GraphQLTester} request preparation and
|
||||
* The main focus is to verify {@link GraphQlTester} request preparation and
|
||||
* response handling.
|
||||
*/
|
||||
public class GraphQLTesterTests {
|
||||
public class GraphQlTesterTests {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
|
||||
public static Stream<GraphQLTesterSetup> argumentSource() {
|
||||
return Stream.of(new MockWebServerSetup(), new MockWebGraphQLHandlerSetup());
|
||||
public static Stream<GraphQlTesterSetup> argumentSource() {
|
||||
return Stream.of(new MockWebServerSetup(), new MockWebGraphQlHandlerSetup());
|
||||
}
|
||||
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void pathAndValueExistsAndEmptyChecks(GraphQLTesterSetup setup) throws Exception {
|
||||
void pathAndValueExistsAndEmptyChecks(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response("{\"me\": {\"name\":\"Luke Skywalker\", \"friends\":[]}}");
|
||||
|
||||
GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute();
|
||||
GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute();
|
||||
|
||||
spec.path("me.name").pathExists().valueExists().valueIsNotEmpty();
|
||||
spec.path("me.friends").valueIsEmpty();
|
||||
@@ -94,12 +94,12 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void matchesJson(GraphQLTesterSetup setup) throws Exception {
|
||||
void matchesJson(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name}}";
|
||||
setup.response("{\"me\": {\"name\":\"Luke Skywalker\", \"friends\":[]}}");
|
||||
|
||||
GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute();
|
||||
GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute();
|
||||
|
||||
spec.path("").matchesJson("{\"me\": {\"name\":\"Luke Skywalker\",\"friends\":[]}}");
|
||||
spec.path("me").matchesJson("{\"name\":\"Luke Skywalker\"}");
|
||||
@@ -115,12 +115,12 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void entity(GraphQLTesterSetup setup) throws Exception {
|
||||
void entity(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name}}";
|
||||
setup.response("{\"me\": {\"name\":\"Luke Skywalker\"}}");
|
||||
|
||||
GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute();
|
||||
GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute();
|
||||
|
||||
MovieCharacter luke = MovieCharacter.create("Luke Skywalker");
|
||||
MovieCharacter han = MovieCharacter.create("Han Solo");
|
||||
@@ -147,7 +147,7 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void entityList(GraphQLTesterSetup setup) throws Exception {
|
||||
void entityList(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response("{" +
|
||||
@@ -158,7 +158,7 @@ public class GraphQLTesterTests {
|
||||
"}"
|
||||
);
|
||||
|
||||
GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query).execute();
|
||||
GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query).execute();
|
||||
|
||||
MovieCharacter han = MovieCharacter.create("Han Solo");
|
||||
MovieCharacter leia = MovieCharacter.create("Leia Organa");
|
||||
@@ -185,7 +185,7 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void operationNameAndVariables(GraphQLTesterSetup setup) throws Exception {
|
||||
void operationNameAndVariables(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "query HeroNameAndFriends($episode: Episode) {" +
|
||||
" hero(episode: $episode) {" +
|
||||
@@ -195,7 +195,7 @@ public class GraphQLTesterTests {
|
||||
|
||||
setup.response("{\"hero\": {\"name\":\"R2-D2\"}}");
|
||||
|
||||
GraphQLTester.ResponseSpec spec = setup.graphQLTester().query(query)
|
||||
GraphQlTester.ResponseSpec spec = setup.graphQlTester().query(query)
|
||||
.operationName("HeroNameAndFriends")
|
||||
.variable("episode", "JEDI")
|
||||
.variables(map -> map.put("foo", "bar"))
|
||||
@@ -215,12 +215,12 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void errorsCheckedOnExecuteAndVerify(GraphQLTesterSetup setup) throws Exception {
|
||||
void errorsCheckedOnExecuteAndVerify(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response(GraphqlErrorBuilder.newError().message("Invalid query").build());
|
||||
|
||||
assertThatThrownBy(() -> setup.graphQLTester().query(query).executeAndVerify())
|
||||
assertThatThrownBy(() -> setup.graphQlTester().query(query).executeAndVerify())
|
||||
.hasMessageContaining("Response has 1 unexpected error(s).");
|
||||
|
||||
setup.verifyRequest(input -> assertThat(input.getQuery()).contains(query));
|
||||
@@ -229,12 +229,12 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void errorsCheckedOnTraverse(GraphQLTesterSetup setup) throws Exception {
|
||||
void errorsCheckedOnTraverse(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response(GraphqlErrorBuilder.newError().message("Invalid query").build());
|
||||
|
||||
assertThatThrownBy(() -> setup.graphQLTester().query(query).execute().path("me"))
|
||||
assertThatThrownBy(() -> setup.graphQlTester().query(query).execute().path("me"))
|
||||
.hasMessageContaining("Response has 1 unexpected error(s).");
|
||||
|
||||
setup.verifyRequest(input -> assertThat(input.getQuery()).contains(query));
|
||||
@@ -243,7 +243,7 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void errorsPartiallyFiltered(GraphQLTesterSetup setup) throws Exception {
|
||||
void errorsPartiallyFiltered(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response(
|
||||
@@ -251,7 +251,7 @@ public class GraphQLTesterTests {
|
||||
GraphqlErrorBuilder.newError().message("some other error").build());
|
||||
|
||||
assertThatThrownBy(() ->
|
||||
setup.graphQLTester().query(query).execute()
|
||||
setup.graphQlTester().query(query).execute()
|
||||
.errors()
|
||||
.filter(error -> error.getMessage().equals("some error"))
|
||||
.verify())
|
||||
@@ -263,14 +263,14 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void errorsFiltered(GraphQLTesterSetup setup) throws Exception {
|
||||
void errorsFiltered(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response(
|
||||
GraphqlErrorBuilder.newError().message("some error").build(),
|
||||
GraphqlErrorBuilder.newError().message("some other error").build());
|
||||
|
||||
setup.graphQLTester().query(query).execute()
|
||||
setup.graphQlTester().query(query).execute()
|
||||
.errors()
|
||||
.filter(error -> error.getMessage().startsWith("some "))
|
||||
.verify()
|
||||
@@ -282,7 +282,7 @@ public class GraphQLTesterTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("argumentSource")
|
||||
void errorsConsumed(GraphQLTesterSetup setup) throws Exception {
|
||||
void errorsConsumed(GraphQlTesterSetup setup) throws Exception {
|
||||
|
||||
String query = "{me {name, friends}}";
|
||||
setup.response(GraphqlErrorBuilder.newError()
|
||||
@@ -290,7 +290,7 @@ public class GraphQLTesterTests {
|
||||
.location(new SourceLocation(1, 2))
|
||||
.build());
|
||||
|
||||
setup.graphQLTester().query(query).execute()
|
||||
setup.graphQlTester().query(query).execute()
|
||||
.errors().satisfy(errors -> {
|
||||
assertThat(errors).hasSize(1);
|
||||
assertThat(errors.get(0).getMessage()).isEqualTo("Invalid query");
|
||||
@@ -305,9 +305,9 @@ public class GraphQLTesterTests {
|
||||
}
|
||||
|
||||
|
||||
private interface GraphQLTesterSetup {
|
||||
private interface GraphQlTesterSetup {
|
||||
|
||||
GraphQLTester graphQLTester();
|
||||
GraphQlTester graphQlTester();
|
||||
|
||||
default void response(String data) throws Exception {
|
||||
response(data, Collections.emptyList());
|
||||
@@ -328,15 +328,15 @@ public class GraphQLTesterTests {
|
||||
}
|
||||
|
||||
|
||||
private static class MockWebServerSetup implements GraphQLTesterSetup {
|
||||
private static class MockWebServerSetup implements GraphQlTesterSetup {
|
||||
|
||||
private final MockWebServer server;
|
||||
|
||||
private final GraphQLTester graphQLTester;
|
||||
private final GraphQlTester graphQlTester;
|
||||
|
||||
MockWebServerSetup() {
|
||||
this.server = new MockWebServer();
|
||||
this.graphQLTester = GraphQLTester.create(initWebTestClient(this.server));
|
||||
this.graphQlTester = GraphQlTester.create(initWebTestClient(this.server));
|
||||
}
|
||||
|
||||
private static WebTestClient initWebTestClient(MockWebServer server) {
|
||||
@@ -345,8 +345,8 @@ public class GraphQLTesterTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphQLTester graphQLTester() {
|
||||
return this.graphQLTester;
|
||||
public GraphQlTester graphQlTester() {
|
||||
return this.graphQlTester;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -393,21 +393,21 @@ public class GraphQLTesterTests {
|
||||
}
|
||||
|
||||
|
||||
private static class MockWebGraphQLHandlerSetup implements GraphQLTesterSetup {
|
||||
private static class MockWebGraphQlHandlerSetup implements GraphQlTesterSetup {
|
||||
|
||||
private final WebGraphQLHandler handler = mock(WebGraphQLHandler.class);
|
||||
private final WebGraphQlHandler handler = mock(WebGraphQlHandler.class);
|
||||
|
||||
private final ArgumentCaptor<WebInput> bodyCaptor = ArgumentCaptor.forClass(WebInput.class);
|
||||
|
||||
private final GraphQLTester graphQLTester;
|
||||
private final GraphQlTester graphQlTester;
|
||||
|
||||
public MockWebGraphQLHandlerSetup() {
|
||||
this.graphQLTester = GraphQLTester.create(this.handler);
|
||||
public MockWebGraphQlHandlerSetup() {
|
||||
this.graphQlTester = GraphQlTester.create(this.handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphQLTester graphQLTester() {
|
||||
return this.graphQLTester;
|
||||
public GraphQlTester graphQlTester() {
|
||||
return this.graphQlTester;
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user