Implemented auto-caching.

Change-Id: Id547073357ab626971e52c7d84f6e86deb05c2c0
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestVCCaching.java b/src/test/java/de/ids_mannheim/korap/collection/TestVCCaching.java
index 745a606..427451d 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestVCCaching.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestVCCaching.java
@@ -37,6 +37,8 @@
         testAddToCache();
         testSearchCachedVC();
         testClearCache();
+        testAddDocToIndex();
+        testDelDocFromIndex();
     }
 
     private void testAddToCache () throws IOException {
@@ -78,7 +80,6 @@
         assertNull(element);
     }
 
-    @Test
     public void testAddDocToIndex () throws IOException {
         testAddToCache();
 
@@ -93,7 +94,6 @@
         assertNull(element);
     }
     
-    @Test
     public void testDelDocFromIndex () throws IOException {
         testAddToCache();
 
@@ -103,4 +103,15 @@
         Element element = KrillCollection.cache.get("cache-goe");
         assertNull(element);
     }
+    
+    @Test
+    public void testAutoCaching () throws IOException {
+        InputStream is = getClass().getClassLoader()
+                .getResourceAsStream("collection/query-with-vc-ref.jsonld");
+        String json = IOUtils.toString(is);
+
+        String result = new Krill(json).apply(this.index).toJsonString();
+        assertNotNull(result);
+        assertTrue(!result.isEmpty());
+    }
 }
diff --git a/src/test/resources/named-vc/named-vc-free.jsonld b/src/test/resources/named-vc/named-vc-free.jsonld
index 1f90e4c..65a6c52 100644
--- a/src/test/resources/named-vc/named-vc-free.jsonld
+++ b/src/test/resources/named-vc/named-vc-free.jsonld
@@ -9,4 +9,4 @@
         "GOE/AGA/01784"
     ],
     "cache" : "true"
-}}
\ No newline at end of file
+}}