File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
src/test/java/graphql/annotations Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -136,13 +136,22 @@ public String fieldWithNamedArgs(@GraphQLName("namedArg") String firstArgument)
136136 public static class TestMappedObject {
137137 @ GraphQLField
138138 public String name ;
139+
140+ @ GraphQLField
141+ public String aaa ;
139142 }
140143
141144 public static class TestObjectDB {
142- public String name ;
145+ public String aaa ;
146+
147+ private String name ;
148+
149+ public String getName () {
150+ return name ;
151+ }
143152
144- public TestObjectDB (String name ) {
145- this .name = name ;
153+ public TestObjectDB (String name , String aaa ) {
154+ this .name = name ; this . aaa = aaa ;
146155 }
147156 }
148157
@@ -156,7 +165,7 @@ public static class ObjectFetcher implements DataFetcher<TestObjectDB> {
156165
157166 @ Override
158167 public TestObjectDB get (DataFetchingEnvironment environment ) {
159- return new TestObjectDB ("test" );
168+ return new TestObjectDB ("test" , "test" );
160169 }
161170 }
162171
@@ -165,9 +174,10 @@ public void fetchTestMappedObject_assertNameIsMappedFromDBObject(){
165174 GraphQLObjectType object = GraphQLAnnotations .object (TestQuery .class );
166175 GraphQLSchema schema = newSchema ().query (object ).build ();
167176
168- ExecutionResult result = GraphQL .newGraphQL (schema ).build ().execute ("{object {name}}" );
177+ ExecutionResult result = GraphQL .newGraphQL (schema ).build ().execute ("{object {name aaa }}" );
169178 assertTrue (result .getErrors ().isEmpty ());
170179 assertEquals (((LinkedHashMap )(((LinkedHashMap )result .getData ()).get ("object" ))).get ("name" ), "test" );
180+ assertEquals (((LinkedHashMap )(((LinkedHashMap )result .getData ()).get ("object" ))).get ("aaa" ), "test" );
171181 }
172182
173183 @ Test
You can’t perform that action at this time.
0 commit comments