Search in sources :

Example 1 with CharacterInput

use of com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput 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 CharacterInput

use of com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput 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 CharacterInput

use of com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput 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 4 with CharacterInput

use of com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput 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)

Example 5 with CharacterInput

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

the class AbstractGraphQLRepositoryInvocationHandlerTest method testInvoke_partialRequest_noRequestName_withObjectArray.

/**
 * no requestName: the method name is the field name of the query type in the GraphQL schema
 */
@SuppressWarnings("unchecked")
@Test
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) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectResponse (com.graphql_java_generator.client.request.ObjectResponse)5 Character (com.graphql_java_generator.domain.client.allGraphQLCases.Character)5 CharacterInput (com.graphql_java_generator.domain.client.allGraphQLCases.CharacterInput)5 Human (com.graphql_java_generator.domain.client.allGraphQLCases.Human)5 Map (java.util.Map)5 Test (org.junit.jupiter.api.Test)5 Execution (org.junit.jupiter.api.parallel.Execution)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 GraphQLTwoRepositoriesAllGraphQlCasesTestCase (com.graphql_java_generator.it_tests.spring_graphql_two_graphql_repos.ok.GraphQLTwoRepositoriesAllGraphQlCasesTestCase)1