Search in sources :

Example 1 with Character

use of com.graphql_java_generator.domain.client.allGraphQLCases.Character in project graphql-maven-plugin-project by graphql-java-generator.

the class GraphQLTwoRepositoriesSpringIntegrationTest method testInvoke_allGraphQLCases_withOneOptionalParam.

@SuppressWarnings("unchecked")
@Test
@Execution(ExecutionMode.CONCURRENT)
void testInvoke_allGraphQLCases_withOneOptionalParam() throws GraphQLRequestExecutionException, GraphQLRequestPreparationException, NoSuchMethodException, SecurityException {
    // Preparation
    CharacterInput input = new CharacterInput();
    Human h = Human.builder().withId("1").withHomePlanet("home planet").withName(" a name ").build();
    doReturn(h).when(spyQueryExecutor).withOneOptionalParamWithBindValues(any(ObjectResponse.class), any(CharacterInput.class), any(Map.class));
    // Go, go, go
    Character verif = graphQLAllGraphQLCasesRepo.withOneOptionalParam(input);
    // Verification
    assertEquals(h, verif);
    assertEquals(// 
    "{appearsIn name}", GraphQLRepositoryTestHelper.getRegisteredGraphQLRequest(invocationHandlerAllGraphQLCases, GraphQLTwoRepositoriesAllGraphQlCasesTestCase.class, "withOneOptionalParam", CharacterInput.class));
}
Also used : Human(com.graphql_java_generator.domain.client.allGraphQLCases.Human) GraphQLTwoRepositoriesAllGraphQlCasesTestCase(com.graphql_java_generator.it_tests.spring_graphql_two_graphql_repos.ok.GraphQLTwoRepositoriesAllGraphQlCasesTestCase) Character(com.graphql_java_generator.domain.client.allGraphQLCases.Character) CharacterInput(com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput) ObjectResponse(com.graphql_java_generator.client.request.ObjectResponse) Map(java.util.Map) Execution(org.junit.jupiter.api.parallel.Execution) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with Character

use of com.graphql_java_generator.domain.client.allGraphQLCases.Character in project graphql-maven-plugin-project by graphql-java-generator.

the class GraphQLRepositorySpringIntegrationTest method testInvoke_partialRequest_noRequestName_withObjectArray.

@SuppressWarnings("unchecked")
@Test
@Execution(ExecutionMode.CONCURRENT)
void testInvoke_partialRequest_noRequestName_withObjectArray() throws GraphQLRequestExecutionException, GraphQLRequestPreparationException, NoSuchMethodException, SecurityException {
    // Preparation
    CharacterInput input = new CharacterInput();
    Human h = Human.builder().withId("1").withHomePlanet("home planet").withName(" a name ").build();
    doReturn(h).when(spyQueryExecutor).withOneOptionalParamWithBindValues(any(ObjectResponse.class), any(CharacterInput.class), any(Map.class));
    // Go, go, go
    Character verif = graphQLRepository.withOneOptionalParam(input);
    // Verification
    assertEquals(h, verif);
    assertEquals(// 
    "{appearsIn name}", GraphQLRepositoryTestHelper.getRegisteredGraphQLRequest(invocationHandler, GraphQLRepositoryTestCase.class, "withOneOptionalParam", CharacterInput.class));
}
Also used : Human(com.graphql_java_generator.domain.client.allGraphQLCases.Human) Character(com.graphql_java_generator.domain.client.allGraphQLCases.Character) CharacterInput(com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput) ObjectResponse(com.graphql_java_generator.client.request.ObjectResponse) Map(java.util.Map) Execution(org.junit.jupiter.api.parallel.Execution) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with Character

use of com.graphql_java_generator.domain.client.allGraphQLCases.Character in project graphql-maven-plugin-project by graphql-java-generator.

the class AbstractGraphQLRepositoryInvocationHandlerTest method testInvoke_partialRequest_mutation_withRequestName.

@SuppressWarnings("unchecked")
@Test
void testInvoke_partialRequest_mutation_withRequestName() throws NoSuchMethodException, SecurityException, GraphQLRequestExecutionException {
    // Preparation
    HumanInput input = new HumanInput();
    Human h = Human.builder().withId("1").withHomePlanet("home planet").withName(" a name ").build();
    doReturn(h).when(spyMutationExecutor).createHumanWithBindValues(any(ObjectResponse.class), any(HumanInput.class), any(Map.class));
    // Go, go, go
    Character verif = graphQLRepository.thisIsAMutation(input);
    // Verification
    assertEquals(h, verif);
    assertEquals("{id name}", GraphQLRepositoryTestHelper.getRegisteredGraphQLRequest(invocationHandler, GraphQLRepositoryTestCase.class, "thisIsAMutation", HumanInput.class));
}
Also used : Human(com.graphql_java_generator.domain.client.allGraphQLCases.Human) Character(com.graphql_java_generator.domain.client.allGraphQLCases.Character) HumanInput(com.graphql_java_generator.domain.client.allGraphQLCases.HumanInput) ObjectResponse(com.graphql_java_generator.client.request.ObjectResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 4 with Character

use of com.graphql_java_generator.domain.client.allGraphQLCases.Character in project graphql-maven-plugin-project by graphql-java-generator.

the class AbstractGraphQLRepositoryInvocationHandlerTest method testInvoke_partialRequest_withRequestName_withoutObjectArray.

@SuppressWarnings("unchecked")
@Test
void testInvoke_partialRequest_withRequestName_withoutObjectArray() throws GraphQLRequestExecutionException, NoSuchMethodException, SecurityException {
    // Preparation
    CharacterInput input = new CharacterInput();
    Human h = Human.builder().withId("1").withHomePlanet("home planet").withName(" a name ").build();
    doReturn(h).when(spyQueryExecutor).withOneOptionalParamWithBindValues(any(ObjectResponse.class), any(CharacterInput.class), any(Map.class));
    // Go, go, go
    Character verif = graphQLRepository.thisIsNotARequestName2(input);
    // Verification
    assertEquals(h, verif);
    assertEquals("{id name appearsIn}", GraphQLRepositoryTestHelper.getRegisteredGraphQLRequest(invocationHandler, GraphQLRepositoryTestCase.class, "thisIsNotARequestName2", CharacterInput.class));
}
Also used : Human(com.graphql_java_generator.domain.client.allGraphQLCases.Human) Character(com.graphql_java_generator.domain.client.allGraphQLCases.Character) CharacterInput(com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput) ObjectResponse(com.graphql_java_generator.client.request.ObjectResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 5 with Character

use of com.graphql_java_generator.domain.client.allGraphQLCases.Character in project graphql-maven-plugin-project by graphql-java-generator.

the class AbstractGraphQLRepositoryInvocationHandlerTest method testInvoke_partialRequest_withRequestName_withObjectArray.

/**
 * with requestName: the method name is the field name of the query type in the GraphQL schema
 */
@SuppressWarnings("unchecked")
@Test
void testInvoke_partialRequest_withRequestName_withObjectArray() throws GraphQLRequestExecutionException, GraphQLRequestPreparationException, NoSuchMethodException, SecurityException {
    // Preparation
    CharacterInput input = new CharacterInput();
    Human h = Human.builder().withId("1").withHomePlanet("home planet").withName(" a name ").build();
    doReturn(h).when(spyQueryExecutor).withOneOptionalParamWithBindValues(any(ObjectResponse.class), any(CharacterInput.class), any(Map.class));
    // Go, go, go
    Character verif = graphQLRepository.thisIsNotARequestName1(input);
    // Verification
    assertEquals(h, verif);
    assertEquals("{appearsIn name id}", GraphQLRepositoryTestHelper.getRegisteredGraphQLRequest(invocationHandler, GraphQLRepositoryTestCase.class, "thisIsNotARequestName1", CharacterInput.class));
}
Also used : Human(com.graphql_java_generator.domain.client.allGraphQLCases.Human) Character(com.graphql_java_generator.domain.client.allGraphQLCases.Character) CharacterInput(com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput) ObjectResponse(com.graphql_java_generator.client.request.ObjectResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Aggregations

Character (com.graphql_java_generator.domain.client.allGraphQLCases.Character)8 Human (com.graphql_java_generator.domain.client.allGraphQLCases.Human)8 ObjectResponse (com.graphql_java_generator.client.request.ObjectResponse)7 Map (java.util.Map)7 Test (org.junit.jupiter.api.Test)7 CharacterInput (com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput)5 HumanInput (com.graphql_java_generator.domain.client.allGraphQLCases.HumanInput)2 Execution (org.junit.jupiter.api.parallel.Execution)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Episode (com.graphql_java_generator.domain.client.allGraphQLCases.Episode)1 GraphQLTwoRepositoriesAllGraphQlCasesTestCase (com.graphql_java_generator.it_tests.spring_graphql_two_graphql_repos.ok.GraphQLTwoRepositoriesAllGraphQlCasesTestCase)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 List (java.util.List)1