Implemented referencing cached collection.

Change-Id: I02f2ee84b3f8e50c5632efc9363eb87d97a754f8
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestVCReference.java b/src/test/java/de/ids_mannheim/korap/collection/TestVCReference.java
new file mode 100644
index 0000000..0a67fa2
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestVCReference.java
@@ -0,0 +1,31 @@
+package de.ids_mannheim.korap.collection;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+
+import de.ids_mannheim.korap.KrillCollection;
+import de.ids_mannheim.korap.response.Message;
+import de.ids_mannheim.korap.util.StatusCodes;
+
+public class TestVCReference {
+
+    @Test
+    public void testUnknownVC () throws IOException {
+
+        InputStream is = getClass().getClassLoader()
+                .getResourceAsStream("collection/unknown-vc-ref.jsonld");
+        String json = IOUtils.toString(is);
+
+        KrillCollection kc = new KrillCollection(json);
+        List<Message> messages = kc.getErrors().getMessages();
+        assertEquals(1, messages.size());
+
+        assertEquals(StatusCodes.MISSING_COLLECTION, messages.get(0).getCode());
+    }
+}
diff --git a/src/test/resources/collection/unknown-vc-ref.jsonld b/src/test/resources/collection/unknown-vc-ref.jsonld
new file mode 100644
index 0000000..8c7e80e
--- /dev/null
+++ b/src/test/resources/collection/unknown-vc-ref.jsonld
@@ -0,0 +1,4 @@
+{"collection": {
+    "@type": "koral:docGroupRef",
+    "ref": "https://korap.ids-mannheim.de/@ndiewald/MyCorpus"
+}}
diff --git a/src/test/resources/named-vc/named-vc-free.jsonld b/src/test/resources/named-vc/named-vc-free.jsonld
new file mode 100644
index 0000000..4e8cd83
--- /dev/null
+++ b/src/test/resources/named-vc/named-vc-free.jsonld
@@ -0,0 +1,11 @@
+{"collection": {
+    "name" : "cache-goe",
+    "@type": "koral:doc",
+    "key": "textSigle",
+    "match": "match:eq",
+    "value": [
+        "GOE/AGF/00000",
+        "GOE/AGA/01784"
+    ]
+}}
+