Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
adding more execution tests
Browse files Browse the repository at this point in the history
  • Loading branch information
siderakis committed Aug 22, 2019
1 parent 350850f commit 96fbb95
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ static class GreetingsSchemaModule extends SchemaModule {
ListenableFuture<TestProto.Proto1> proto1() {
return Futures.immediateFuture(
TestProto.Proto1.newBuilder()
.setCamelCaseName(101)
.setId("id")
.setIntField(1)
.setNameField("name")
.setTestInnerProto(TestProto.Proto1.InnerProto.newBuilder().setFoo("foooo"))
.putAllMapField(
ImmutableMap.of(
"a", "1",
Expand Down Expand Up @@ -230,6 +235,40 @@ public void executionQueryWithMapResponse() {
ImmutableMap.of("key", "c", "value", "3"))))));
}

@Test
public void executionQueryWithAllFields() {
GraphQL graphQL =
GraphQL.newGraphQL(schema)
.instrumentation(GuavaListenableFutureSupport.listenableFutureInstrumentation())
.build();
ExecutionInput executionInput =
ExecutionInput.newExecutionInput()
.query(
"query { proto1 { mapField { key value } camelCaseName id intField RenamedField testInnerProto {foo} } }")
.build();
ExecutionResult executionResult = graphQL.execute(executionInput);
assertThat(executionResult.getErrors()).isEmpty();
assertThat(executionResult.toSpecification())
.isEqualTo(
ImmutableMap.of(
"data",
ImmutableMap.of(
"proto1",
ImmutableMap.builder()
.put(
"mapField",
ImmutableList.of(
ImmutableMap.of("key", "a", "value", "1"),
ImmutableMap.of("key", "b", "value", "2"),
ImmutableMap.of("key", "c", "value", "3")))
.put("camelCaseName", (long) 101)
.put("id", "id")
.put("intField", (long) 1)
.put("RenamedField", "name")
.put("testInnerProto", ImmutableMap.of("foo", "foooo"))
.build())));
}

@Test
public void handlesRuntimeExceptionMessage() {
GraphQL graphQL = GraphQL.newGraphQL(schema).build();
Expand Down

0 comments on commit 96fbb95

Please sign in to comment.