tyge68 commented on a change in pull request #11:
URL: 
https://github.com/apache/sling-org-apache-sling-graphql-core/pull/11#discussion_r556014823



##########
File path: 
src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java
##########
@@ -189,16 +189,30 @@ public void invalidTypeResolverNamesTest() {
     }
 
     @Test
-    public void unionFetcherTest() throws Exception {
-        final String json = queryJSON("{ unionFetcher { items { ... on Test { 
testingArgument }  ... on SlingResource { path }} } }");
-        assertThat(json, hasJsonPath("$.data.unionFetcher"));
-        assertThat(json, 
hasJsonPath("$.data.unionFetcher.items[0].testingArgument", equalTo("1, 2, 
3")));
-        assertThat(json, hasJsonPath("$.data.unionFetcher.items[1].path", 
equalTo(resource.getPath())));
+    public void unionQueryTest() throws Exception {
+        final String json = queryJSON("{ unionQuery { characters { ... on 
Human { name address }  ... on Droid { name primaryFunction } } } }");
+        assertThat(json, hasJsonPath("$.data.unionQuery"));
+        assertThat(json, hasJsonPath("$.data.unionQuery.characters[0].name", 
equalTo("Luke")));
+        assertThat(json, 
hasJsonPath("$.data.unionQuery.characters[0].address", equalTo("Tatooine")));
+        assertThat(json, hasJsonPath("$.data.unionQuery.characters[1].name", 
equalTo("R2-D2")));
+        assertThat(json, 
hasJsonPath("$.data.unionQuery.characters[1].primaryFunction", 
equalTo("whistle")));
+    }
+
+    @Test
+    public void interfaceQueryTest() throws Exception {
+        final String json = queryJSON("{ interfaceQuery { characters { id ... 
on Human { name address }  ... on Droid { name primaryFunction } } } }");
+        assertThat(json, hasJsonPath("$.data.interfaceQuery"));
+        assertThat(json, hasJsonPath("$.data.interfaceQuery.characters[0].id", 
equalTo("human-1")));
+        assertThat(json, 
hasJsonPath("$.data.interfaceQuery.characters[0].name", equalTo("Luke")));
+        assertThat(json, 
hasJsonPath("$.data.interfaceQuery.characters[0].address", 
equalTo("Tatooine")));
+        assertThat(json, hasJsonPath("$.data.interfaceQuery.characters[1].id", 
equalTo("droid-1")));
+        assertThat(json, 
hasJsonPath("$.data.interfaceQuery.characters[1].name", equalTo("R2-D2")));
+        assertThat(json, 
hasJsonPath("$.data.interfaceQuery.characters[1].primaryFunction", 
equalTo("whistle")));
     }
 
     @Test
     public void selectionSetTest() throws Exception {
-        queryJSON("{ combinedFetcher { boolValue resourcePath aTest { 
boolValue test resourcePath } allTests { boolValue test resourcePath } items { 
... on Test { testingArgument }  ... on SlingResource { path }} } }");
+        queryJSON("{ combinedFetcher { boolValue resourcePath aTest { 
boolValue test resourcePath } allTests { boolValue test resourcePath } 
characters { ... on Human { address }  ... on Droid { primaryFunction }} } }");

Review comment:
       would it be possible to add the "id" in the sample query ? so that it 
could be check if that is properly detected as a selectedfield ? like 
"characters/id"




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to