use of com.graphql_java_generator.domain.client.allGraphQLCases.AnotherMutationType in project graphql-maven-plugin-project by graphql-java-generator.
the class AbstractGraphQLRequest_fragmentTest method testBuild_Partial_createHuman_withDirectivesWithOnClause.
@Test
void testBuild_Partial_createHuman_withDirectivesWithOnClause() throws GraphQLRequestPreparationException, GraphQLRequestExecutionException, JsonProcessingException {
// Preparation
AnotherMutationType mutationType = new AnotherMutationType("http://localhost/graphql");
params = new HashMap<>();
params.put("anotherMutationTypeCreateHumanHuman", input);
params.put("value", "the mutation value");
params.put("anotherValue", "the other mutation value");
params.put("expandedInfo", true);
// Go, go, go
@SuppressWarnings("deprecation") AbstractGraphQLRequest graphQLRequest = mutationType.getCreateHumanResponseBuilder().withQueryResponseDef("{id name ... on Human @include(if: &expandedInfo) {friends {id name} appearsIn @testDirective(value:&value,anotherValue:?anotherValue)}}}").build();
// Verification
assertEquals(0, graphQLRequest.aliasFields.size());
assertEquals(//
"{\"query\":\"mutation" + //
"{createHuman(human:{name:\\\"a new name\\\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{id name ... on Human @include(if:true){friends{id name __typename} appearsIn @testDirective(value:\\\"the mutation value\\\",anotherValue:\\\"the other mutation value\\\") __typename}}}" + //
"\"}", graphQLRequest.buildRequestAsString(params));
QueryExecutorImpl_allGraphqlCases_Test.checkRequestMap(graphQLRequest.buildRequestAsMap(params), //
"" + //
"mutation" + //
"{createHuman(human:{name:\"a new name\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{id name ... on Human @include(if:true){friends{id name __typename} appearsIn @testDirective(value:\"the mutation value\",anotherValue:\"the other mutation value\") __typename}}}", null, null);
}
use of com.graphql_java_generator.domain.client.allGraphQLCases.AnotherMutationType in project graphql-maven-plugin-project by graphql-java-generator.
the class AliasesTest method testBuild_Partial_createHuman.
@Test
@Execution(ExecutionMode.CONCURRENT)
void testBuild_Partial_createHuman() throws GraphQLRequestPreparationException, GraphQLRequestExecutionException, JsonProcessingException {
// Preparation
AnotherMutationType mutationType = new AnotherMutationType("http://localhost/graphql");
params = new HashMap<>();
params.put("anotherMutationTypeCreateHumanHuman", input);
params.put("value", "the mutation value");
params.put("anotherValue", "the other mutation value");
// Go, go, go
@SuppressWarnings("deprecation") AbstractGraphQLRequest graphQLRequest = mutationType.getCreateHumanResponseBuilder().withQueryResponseDef("{aliasId:id \taliasName: name aliasAppearsIn :appearsIn aliasFriends : friends {aliasId2:id aliasName2:name}}}").build();
// Verification
assertEquals(//
"{\"query\":\"mutation" + //
"{createHuman(human:{name:\\\"a new name\\\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{aliasId:id aliasName:name aliasAppearsIn:appearsIn aliasFriends:friends{aliasId2:id aliasName2:name __typename} __typename}}" + //
"\"}", graphQLRequest.buildRequestAsString(params));
QueryExecutorImpl_allGraphqlCases_Test.checkRequestMap(graphQLRequest.buildRequestAsMap(params), //
"" + //
"mutation" + //
"{createHuman(human:{name:\"a new name\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{aliasId:id aliasName:name aliasAppearsIn:appearsIn aliasFriends:friends{aliasId2:id aliasName2:name __typename} __typename}}", null, null);
}
use of com.graphql_java_generator.domain.client.allGraphQLCases.AnotherMutationType in project graphql-maven-plugin-project by graphql-java-generator.
the class AbstractGraphQLRequest_fragmentTest method testBuild_Partial_createHuman_withDirectivesWithoutOnClause.
@Test
void testBuild_Partial_createHuman_withDirectivesWithoutOnClause() throws GraphQLRequestPreparationException, GraphQLRequestExecutionException, JsonProcessingException {
// Preparation
AnotherMutationType mutationType = new AnotherMutationType("http://localhost/graphql");
params = new HashMap<>();
params.put("anotherMutationTypeCreateHumanHuman", input);
params.put("value", "the mutation value");
params.put("anotherValue", "the other mutation value");
params.put("expandedInfo", false);
// Go, go, go
@SuppressWarnings("deprecation") AbstractGraphQLRequest graphQLRequest = mutationType.getCreateHumanResponseBuilder().withQueryResponseDef("{id name ... @include(if: &expandedInfo) {friends {id name} appearsIn @testDirective(value:&value,anotherValue:?anotherValue)}}}").build();
// Verification
assertEquals(0, graphQLRequest.aliasFields.size());
assertEquals(//
"{\"query\":\"mutation" + //
"{createHuman(human:{name:\\\"a new name\\\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{id name ... @include(if:false){friends{id name __typename} appearsIn @testDirective(value:\\\"the mutation value\\\",anotherValue:\\\"the other mutation value\\\") __typename}}}" + //
"\"}", graphQLRequest.buildRequestAsString(params));
QueryExecutorImpl_allGraphqlCases_Test.checkRequestMap(graphQLRequest.buildRequestAsMap(params), //
"" + //
"mutation" + //
"{createHuman(human:{name:\"a new name\",appearsIn:[JEDI,EMPIRE,NEWHOPE]})" + //
"{id name ... @include(if:false){friends{id name __typename} appearsIn @testDirective(value:\"the mutation value\",anotherValue:\"the other mutation value\") __typename}}}", null, null);
}
use of com.graphql_java_generator.domain.client.allGraphQLCases.AnotherMutationType in project graphql-maven-plugin-project by graphql-java-generator.
the class AbstractGraphQLRequest_allGraphQLCasesTest method testBuild_Partial_createHuman_Alias_Errors.
@Test
@Execution(ExecutionMode.CONCURRENT)
void testBuild_Partial_createHuman_Alias_Errors() throws GraphQLRequestPreparationException, GraphQLRequestExecutionException {
// Preparation
AnotherMutationTypeExecutor mutationType = new AnotherMutationType("http://localhost/graphql");
GraphQLRequestPreparationException e;
e = assertThrows(GraphQLRequestPreparationException.class, () -> mutationType.getCreateHumanGraphQLRequest("{alias:id alias:name}"));
assertTrue(e.getMessage().contains(" 'alias' "));
e = assertThrows(GraphQLRequestPreparationException.class, () -> mutationType.getCreateHumanGraphQLRequest("{aliasId:id friends {aliasId:name}}}"));
assertTrue(e.getMessage().contains(" 'aliasId' "));
}
use of com.graphql_java_generator.domain.client.allGraphQLCases.AnotherMutationType in project graphql-maven-plugin-project by graphql-java-generator.
the class AbstractGraphQLRequest_allGraphQLCasesTest method testBuild_Full_createHuman_withBuilder.
@Test
@Execution(ExecutionMode.CONCURRENT)
void testBuild_Full_createHuman_withBuilder() throws GraphQLRequestPreparationException, GraphQLRequestExecutionException, JsonProcessingException {
// Preparation
AnotherMutationType mutationType = new AnotherMutationType("http://localhost/graphql");
// Go, go, go
@SuppressWarnings("deprecation") AbstractGraphQLRequest graphQLRequest = //
mutationType.getResponseBuilder().withQueryResponseDef(//
"mutation { createHuman (human: &humanInput) @testDirective(value:&value, anotherValue:?anotherValue) " + //
"{id name appearsIn friends {id name}}}").build();
// Verification
assertEquals(0, graphQLRequest.aliasFields.size());
assertEquals(//
"{\"query\":\"mutation" + //
"{createHuman(human:{name:\\\"a new name\\\",appearsIn:[JEDI,EMPIRE,NEWHOPE]}) @testDirective(value:\\\"the mutation value\\\",anotherValue:\\\"the other mutation value\\\")" + //
"{id name appearsIn friends{id name __typename} __typename}}" + //
"\"}", graphQLRequest.buildRequestAsString(params));
QueryExecutorImpl_allGraphqlCases_Test.checkRequestMap(graphQLRequest.buildRequestAsMap(params), //
"" + //
"mutation" + //
"{createHuman(human:{name:\"a new name\",appearsIn:[JEDI,EMPIRE,NEWHOPE]}) @testDirective(value:\"the mutation value\",anotherValue:\"the other mutation value\")" + //
"{id name appearsIn friends{id name __typename} __typename}}", null, null);
}
Aggregations