use of org.springframework.graphql.support.DocumentSource in project spring-graphql by spring-projects.
the class WebGraphQlClientBuilderTests method mutateDocumentSource.
@ParameterizedTest
@MethodSource("argumentSource")
void mutateDocumentSource(ClientBuilderSetup builderSetup) {
DocumentSource documentSource = name -> name.equals("name") ? Mono.just(DOCUMENT) : Mono.error(new IllegalArgumentException());
// Original
WebGraphQlClient.Builder<?> builder = builderSetup.initBuilder().documentSource(documentSource);
WebGraphQlClient client = builder.build();
client.documentName("name").execute().block(TIMEOUT);
WebInput input = builderSetup.getWebInput();
assertThat(input.getDocument()).isEqualTo(DOCUMENT);
// Mutate
client = client.mutate().build();
client.documentName("name").execute().block(TIMEOUT);
input = builderSetup.getWebInput();
assertThat(input.getDocument()).isEqualTo(DOCUMENT);
}
use of org.springframework.graphql.support.DocumentSource in project spring-graphql by spring-projects.
the class WebGraphQlTesterBuilderTests method mutateDocumentSource.
@ParameterizedTest
@MethodSource("argumentSource")
void mutateDocumentSource(TesterBuilderSetup builderSetup) {
DocumentSource documentSource = name -> name.equals("name") ? Mono.just(DOCUMENT) : Mono.error(new IllegalArgumentException());
// Original
WebGraphQlTester.Builder<?> builder = builderSetup.initBuilder().documentSource(documentSource);
WebGraphQlTester tester = builder.build();
tester.documentName("name").execute();
WebInput input = builderSetup.getWebInput();
assertThat(input.getDocument()).isEqualTo(DOCUMENT);
// Mutate
tester = tester.mutate().build();
tester.documentName("name").execute();
input = builderSetup.getWebInput();
assertThat(input.getDocument()).isEqualTo(DOCUMENT);
}
use of org.springframework.graphql.support.DocumentSource in project spring-graphql by spring-projects.
the class GraphQlClientBuilderTests method mutateDocumentSource.
@Test
void mutateDocumentSource() {
DocumentSource documentSource = name -> name.equals("name") ? Mono.just(DOCUMENT) : Mono.error(new IllegalArgumentException());
setMockResponse("{}");
// Original
GraphQlClient.Builder<?> builder = graphQlClientBuilder().documentSource(documentSource);
GraphQlClient client = builder.build();
client.documentName("name").execute().block(TIMEOUT);
GraphQlRequest request = request();
assertThat(request.getDocument()).isEqualTo(DOCUMENT);
// Mutate
client = client.mutate().build();
client.documentName("name").execute().block(TIMEOUT);
assertThat(request().getDocument()).isEqualTo(DOCUMENT);
}
use of org.springframework.graphql.support.DocumentSource in project spring-graphql by spring-projects.
the class GraphQlTesterBuilderTests method mutateDocumentSource.
@Test
void mutateDocumentSource() {
DocumentSource documentSource = name -> name.equals("name") ? Mono.just(DOCUMENT) : Mono.error(new IllegalArgumentException());
setMockResponse("{}");
// Original
GraphQlTester.Builder<?> builder = graphQlTesterBuilder().documentSource(documentSource);
GraphQlTester tester = builder.build();
tester.documentName("name").execute();
assertThat(requestInput().getDocument()).isEqualTo(DOCUMENT);
// Mutate
tester = tester.mutate().build();
tester.documentName("name").execute();
assertThat(requestInput().getDocument()).isEqualTo(DOCUMENT);
}
Aggregations