use of com.yahoo.elide.core.request.Argument in project elide by yahoo.
the class GraphQLEntityProjectMakerTest method testParameterizedAttribute.
@Test
public void testParameterizedAttribute() {
String graphQLRequest = document(selection(field("parameterizedExample", arguments(argument("entityArgument", "xyz", true)), selections(field("attribute", arguments(argument("argument", "abc", true))))))).toQuery();
GraphQLEntityProjectionMaker projectionMaker = new GraphQLEntityProjectionMaker(settings);
GraphQLProjectionInfo projectionInfo = projectionMaker.make(graphQLRequest);
assertEquals(1, projectionInfo.getProjections().size());
EntityProjection projection = projectionInfo.getProjections().values().iterator().next();
// Verify Entity Argument
assertEquals(1, projection.getArguments().size());
Argument entityArgument = projection.getArguments().iterator().next();
assertEquals("entityArgument", entityArgument.getName());
assertEquals(String.class, entityArgument.getType());
assertEquals("xyz", entityArgument.getValue());
// Verify Attribute Argument
assertEquals(1, projection.getAttributes().size());
Attribute attribute = projection.getAttributes().iterator().next();
assertEquals(1, attribute.getArguments().size());
Argument argument = attribute.getArguments().iterator().next();
assertEquals("argument", argument.getName());
assertEquals(String.class, argument.getType());
assertEquals("abc", argument.getValue());
}
Aggregations