Add test for docGroupRef in docGroup

Change-Id: I2138dcf2eae4a1be3354a5f29b629692115a1190
diff --git a/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
index f84f612..991f923 100644
--- a/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
@@ -48,6 +48,41 @@
         assertEquals("koral:docGroupRef", res.at("/collection/@type").asText());
         assertEquals("http://korap.ids-mannheim.de/user/vc/myCorpus", res.at("/collection/ref").asText());
 	}
+
+    @Test
+    public void testNestedVCRef () throws IOException {
+        collection = "availability = /CC-BY.*/ & referTo \"DeReKo-CoRoLa-comp-subcorpus\"";
+        qs.setQuery(query, ql);
+        qs.setCollection(collection);
+
+        res = mapper.readTree(qs.toJSON());
+        assertEquals("koral:docGroup", res.at("/collection/@type").asText());
+        assertEquals("koral:doc", res.at("/collection/operands/0/@type").asText());
+
+        assertEquals("type:regex", res.at("/collection/operands/0/type").asText());
+        assertEquals("availability", res.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*", res.at("/collection/operands/0/value").asText());
+        
+        assertEquals("koral:docGroupRef", res.at("/collection/operands/1/@type").asText());
+        assertEquals("DeReKo-CoRoLa-comp-subcorpus", res.at("/collection/operands/1/ref").asText());
+
+        collection = "(availability = /CC-BY.*/ & referTo \"DeReKo-CoRoLa-comp-subcorpus\")";
+        qs.setQuery(query, ql);
+        qs.setCollection(collection);
+
+        res = mapper.readTree(qs.toJSON());
+        assertEquals("koral:docGroup", res.at("/collection/@type").asText());
+        assertEquals("koral:doc", res.at("/collection/operands/0/@type").asText());
+
+        assertEquals("type:regex", res.at("/collection/operands/0/type").asText());
+        assertEquals("availability", res.at("/collection/operands/0/key").asText());
+        assertEquals("CC-BY.*", res.at("/collection/operands/0/value").asText());
+        
+        assertEquals("koral:docGroupRef", res.at("/collection/operands/1/@type").asText());
+        assertEquals("DeReKo-CoRoLa-comp-subcorpus", res.at("/collection/operands/1/ref").asText());
+
+
+    }
     
     @Test
     public void testContext () throws JsonProcessingException, IOException {