Fixed foundry rewrite.

Change-Id: I790af4052610afad98a31a1376c89caaa66699f8
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java b/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
index 948ec50..675522d 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
+++ b/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
@@ -42,7 +42,7 @@
             mapper = new LayerMapper(config);
             
         if (node.get("@type").equals("koral:span")) {
-            if (!node.at("/wrap").rawNode().isMissingNode()){
+            if (!node.isMissingNode("/wrap")){
                 JsonNode term = rewriteQuery(node.at("/wrap"), config, user);
                 node.replaceAt("/wrap", term, new RewriteIdentifier("koral:term", "replace"));
             }
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java b/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
index 0614f91..70f23bc 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
+++ b/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
@@ -265,4 +265,9 @@
         }
 
     }
+
+
+    public boolean isMissingNode (String string) {
+        return this.node.at(string).isMissingNode();
+    }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
index be22f88..5f9a551 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
@@ -39,7 +39,6 @@
     public void testRetrieveUserVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         ClientResponse response = resource().path("vc").path("user")
-                .queryParam("username", "dory")
                 .header(Attributes.AUTHORIZATION,
                         handler.createBasicAuthorizationHeaderValue("dory",
                                 "pass"))
@@ -156,8 +155,8 @@
         ClientResponse response = resource().path("vc").path("store")
                 .entity(json).post(ClientResponse.class);
         String entity = response.getEntity(String.class);
-        //        System.out.println(entity);
-        assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
+                System.out.println(entity);
+        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.DESERIALIZATION_FAILED,