Fixed KustvaktResponseHandler and missing exceptions in JsonUtils. 

Change-Id: I3a95361659cebf91dc9175d08891dd67815b1851
diff --git a/full/src/test/java/de/ids_mannheim/korap/misc/CollectionQueryBuilderTest.java b/full/src/test/java/de/ids_mannheim/korap/misc/CollectionQueryBuilderTest.java
index 0656c02..3142330 100644
--- a/full/src/test/java/de/ids_mannheim/korap/misc/CollectionQueryBuilderTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/misc/CollectionQueryBuilderTest.java
@@ -1,5 +1,7 @@
 package de.ids_mannheim.korap.misc;
 import com.fasterxml.jackson.databind.JsonNode;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.resources.KustvaktResource;
 import de.ids_mannheim.korap.resources.VirtualCollection;
@@ -19,7 +21,7 @@
 public class CollectionQueryBuilderTest {
 
     @Test
-    public void testsimpleAdd () {
+    public void testsimpleAdd () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("corpusSigle=WPD");
 
@@ -32,7 +34,7 @@
 
 
     @Test
-    public void testSimpleConjunction () {
+    public void testSimpleConjunction () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("corpusSigle=WPD & textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
@@ -49,7 +51,7 @@
 
 
     @Test
-    public void testSimpleDisjunction () {
+    public void testSimpleDisjunction () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("corpusSigle=WPD | textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
@@ -64,7 +66,7 @@
 
 
     @Test
-    public void testComplexSubQuery () {
+    public void testComplexSubQuery () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("(corpusSigle=WPD) | (textClass=freizeit & corpusSigle=BRZ13)");
         JsonNode node = JsonUtils.readTree(b.toJSON());
@@ -80,7 +82,7 @@
 
 
     @Test
-    public void testAddResourceQueryAfter () {
+    public void testAddResourceQueryAfter () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("(textClass=politik & title=\"random title\") | textClass=wissenschaft");
 
@@ -109,7 +111,7 @@
 
 
     @Test
-    public void testAddComplexResourceQueryAfter () {
+    public void testAddComplexResourceQueryAfter () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("(title=\"random title\") | (textClass=wissenschaft)");
 
@@ -135,7 +137,7 @@
 
 
     @Test
-    public void testBuildQuery () {
+    public void testBuildQuery () throws KustvaktException {
         String coll = "corpusSigle=WPD";
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
@@ -171,7 +173,7 @@
 
 
     @Test
-    public void testBaseQueryBuild () {
+    public void testBaseQueryBuild () throws KustvaktException {
         KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
         b.with("(corpusSigle=ADF) | (textClass=freizeit & corpusSigle=WPD)");
 
@@ -192,7 +194,7 @@
 
 
     @Test
-    public void testNodeMergeWithBase () {
+    public void testNodeMergeWithBase () throws KustvaktException {
         String coll = "corpusSigle=WPD";
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
@@ -214,7 +216,7 @@
 
 
     @Test
-    public void testNodeMergeWithoutBase () {
+    public void testNodeMergeWithoutBase () throws KustvaktException {
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
         check.setQuery(query, "poliqarp");
@@ -235,7 +237,7 @@
 
 
     @Test
-    public void testNodeMergeWithoutBaseWrongOperator () {
+    public void testNodeMergeWithoutBaseWrongOperator () throws KustvaktException {
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
         check.setQuery(query, "poliqarp");
@@ -263,7 +265,7 @@
 
 
     @Test
-    public void testAddOROperator () {
+    public void testAddOROperator () throws KustvaktException {
         String coll = "corpusSigle=WPD";
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
@@ -282,7 +284,7 @@
 
 
     @Test
-    public void testAddANDOperator () {
+    public void testAddANDOperator () throws KustvaktException {
         String coll = "corpusSigle=WPD";
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
@@ -301,7 +303,7 @@
 
 
     @Test
-    public void testAddDefaultOperator () {
+    public void testAddDefaultOperator () throws KustvaktException {
         String coll = "corpusSigle=WPD";
         String query = "[base=Haus]";
         QuerySerializer check = new QuerySerializer();
@@ -320,7 +322,7 @@
 
 
     @Test
-    public void testCollectionMergeWithFromResource () {
+    public void testCollectionMergeWithFromResource () throws KustvaktException {
         KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
         builder.with("textClass=politik & corpusSigle=WPD");
         KustvaktResource resource = new VirtualCollection();
@@ -339,7 +341,7 @@
 
 
     @Test
-    public void testCollectionMergeWithFromResourceNoCollection () {
+    public void testCollectionMergeWithFromResourceNoCollection () throws KustvaktException {
         KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
         builder.with("textClass=politik & corpusSigle=WPD");
         KustvaktResource resource = new VirtualCollection();
@@ -358,7 +360,7 @@
 
 
     @Test
-    public void testCollectionMergeFromQuerySerializer () {
+    public void testCollectionMergeFromQuerySerializer () throws KustvaktException {
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[base=Haus]", "poliqarp");
         KoralCollectionQueryBuilder total = new KoralCollectionQueryBuilder();
@@ -384,7 +386,7 @@
 
 
     @Test
-    public void testBaseCollectionNull () {
+    public void testBaseCollectionNull () throws KustvaktException {
         // base is missing collection segment
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[base=Haus]", "poliqarp");
@@ -412,7 +414,7 @@
 
 
     @Test
-    public void testMergeCollectionNull () {
+    public void testMergeCollectionNull () throws KustvaktException {
         // merge json is missing collection segment
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[base=Haus]", "poliqarp");
diff --git a/full/src/test/java/de/ids_mannheim/korap/misc/LocalQueryTest.java b/full/src/test/java/de/ids_mannheim/korap/misc/LocalQueryTest.java
index e5020f9..ff8df15 100644
--- a/full/src/test/java/de/ids_mannheim/korap/misc/LocalQueryTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/misc/LocalQueryTest.java
@@ -37,7 +37,7 @@
 
 
     @Test
-    public void testQuery () {
+    public void testQuery () throws KustvaktException {
         SearchKrill krill = new SearchKrill(index);
         KoralCollectionQueryBuilder coll = new KoralCollectionQueryBuilder();
         coll.with(qstring);
diff --git a/full/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java b/full/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
index 43ff936..439462a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
@@ -131,7 +131,7 @@
 
 
     @Test
-    public void testDataFactoryAdd () {
+    public void testDataFactoryAdd () throws KustvaktException {
         String data = "{}";
         Object node = JsonUtils.readTree(data);
 
@@ -153,7 +153,7 @@
 
 
     @Test
-    public void testDataFactoryGet () {
+    public void testDataFactoryGet () throws KustvaktException {
         String data = "{}";
         Object node = JsonUtils.readTree(data);
 
@@ -203,7 +203,7 @@
 
 
     @Test
-    public void testDataFactoryEmbeddedProperty () {
+    public void testDataFactoryEmbeddedProperty () throws KustvaktException {
         String data = "{}";
         JsonNode node = JsonUtils.readTree(data);
 
@@ -247,7 +247,7 @@
 
 
     @Test
-    public void testDataFactoryMerge () {
+    public void testDataFactoryMerge () throws KustvaktException {
         String data = "{}";
         Object node = JsonUtils.readTree(data);
 
@@ -277,7 +277,7 @@
 
     @Test
     @Ignore
-    public void testDataFactoryRemove () {
+    public void testDataFactoryRemove () throws KustvaktException {
         String data = "{}";
         Object node = JsonUtils.readTree(data);
 
@@ -382,7 +382,7 @@
 
 
     @Test
-    public void testDataFactoryKeys () {
+    public void testDataFactoryKeys () throws KustvaktException {
         String data = "{}";
         Object node = JsonUtils.readTree(data);
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
index 4e06330..f8e664a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
@@ -65,7 +65,7 @@
 	}
 
     @Test
-    public void testSearch () {
+    public void testSearch () throws KustvaktException {
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[orth=der]", "poliqarp");
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
index 77eeb10..58d3ad6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -53,7 +53,7 @@
     }
 
     @Test
-    public void testSessionToken() {
+    public void testSessionToken() throws KustvaktException {
         String auth = BasicHttpAuth.encode(credentials[0], credentials[1]);
         ClientResponse response = resource().path("auth")
                 .path("sessionToken").header(Attributes.AUTHORIZATION, auth)
@@ -89,7 +89,7 @@
     }
 
     @Test
-    public void testSessionTokenExpire() {
+    public void testSessionTokenExpire() throws KustvaktException {
         String auth = BasicHttpAuth.encode(credentials[0], credentials[1]);
         ClientResponse response = resource().path("auth")
                 .path("sessionToken").header(Attributes.AUTHORIZATION, auth)
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/MatchInfoServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/MatchInfoServiceTest.java
index 374f9fc..3b575d4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/MatchInfoServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/MatchInfoServiceTest.java
@@ -20,7 +20,7 @@
 public class MatchInfoServiceTest extends FastJerseyTest {
 
     @Test
-    public void testGetMatchInfoPublicCorpus () {
+    public void testGetMatchInfoPublicCorpus () throws KustvaktException {
 
         ClientResponse response = resource()
                 .path("corpus").path("GOE").path("AGA").path("01784")
@@ -46,7 +46,7 @@
     }
     
     @Test
-    public void testGetMatchInfoNotAllowed () {
+    public void testGetMatchInfoNotAllowed () throws KustvaktException {
 
         ClientResponse response = resource()
                 .path("corpus").path("GOE").path("AGI").path("04846")
@@ -67,7 +67,7 @@
     }
 
     @Test
-    public void testGetMatchInfoWithAuthentication () {
+    public void testGetMatchInfoWithAuthentication () throws KustvaktException {
         ClientResponse response = resource()
                 .path("corpus").path("GOE").path("AGI").path("04846")
                 .path("p36875-36876").path("matchInfo")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
index f4d0144..807ee1f 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
@@ -8,7 +8,9 @@
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.UniformInterfaceException;
 
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.TestHelper;
@@ -32,7 +34,7 @@
 
 
     @Test
-    public void testAuthorizeClient () {
+    public void testAuthorizeClient () throws ClientHandlerException, UniformInterfaceException, KustvaktException {
         String auth = BasicHttpAuth.encode(helper().getUser().getUsername(),
                 (String) TestHelper.getUserCredentials().get(Attributes.PASSWORD));
         ClientResponse response = resource().path(getAPIVersion()).path("oauth2")
@@ -53,7 +55,7 @@
 
     @Test
     @Ignore
-    public void testRevokeClient () {
+    public void testRevokeClient () throws ClientHandlerException, UniformInterfaceException, KustvaktException {
         ClientResponse response = resource().path(getAPIVersion()).path("oauth2")
                 .path("register")
                 .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
@@ -68,7 +70,7 @@
 
     @Test
     @Ignore
-    public void authenticate () {
+    public void authenticate () throws KustvaktException {
         Map<String, Object> cred = TestHelper.getUserCredentials();
         String enc = BasicHttpAuth.encode((String) cred.get(Attributes.USERNAME), (String) cred.get(Attributes.PASSWORD));
         ClientResponse response = resource().path(getAPIVersion()).path("oauth2")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java
index eed1024..88fd598 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java
@@ -37,7 +37,7 @@
 
 
     @Test
-    public void testQuerySerializationFilteredPublic () {
+    public void testQuerySerializationFilteredPublic () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("corpus/WPD13/query").queryParam("q", "[orth=der]")
@@ -55,7 +55,7 @@
 
 
     @Test
-    public void testQuerySerializationUnexistingResource () {
+    public void testQuerySerializationUnexistingResource () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("corpus/ZUW19/query").queryParam("q", "[orth=der]")
@@ -72,7 +72,7 @@
 
 
     @Test
-    public void testQuerySerializationWithNonPublicCorpus () {
+    public void testQuerySerializationWithNonPublicCorpus () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
@@ -89,7 +89,7 @@
 
 
     @Test
-    public void testQuerySerializationWithAuthentication () {
+    public void testQuerySerializationWithAuthentication () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
@@ -109,7 +109,7 @@
 
 
     @Test
-    public void testQuerySerializationWithNewCollection () {
+    public void testQuerySerializationWithNewCollection () throws KustvaktException {
         // Add Virtual Collection
         ClientResponse response = resource()
 
@@ -191,7 +191,7 @@
 
 
     @Test
-    public void testQuerySerializationOfVirtualCollection () {
+    public void testQuerySerializationOfVirtualCollection () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("collection/GOE-VC/query").queryParam("q", "[orth=der]")
@@ -218,7 +218,7 @@
 
 
     @Test
-    public void testMetaQuerySerialization () {
+    public void testMetaQuerySerialization () throws KustvaktException {
         ClientResponse response = resource()
 
                 .path("query").queryParam("context", "sentence")
@@ -245,7 +245,7 @@
 
 
     @Test
-    public void testMetaQuerySerializationWithOffset () {
+    public void testMetaQuerySerializationWithOffset () throws KustvaktException{
         ClientResponse response = resource()
 
                 .path("query").queryParam("context", "sentence")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoServiceTest.java
index 2ef3fd1..06741be 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoServiceTest.java
@@ -31,7 +31,7 @@
     }
 
     @Test
-    public void testGetPublicVirtualCollectionInfo () {
+    public void testGetPublicVirtualCollectionInfo () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -44,7 +44,7 @@
 
 
     @Test
-    public void testGetVirtualCollectionInfoWithAuthentication () {
+    public void testGetVirtualCollectionInfoWithAuthentication () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection")
                 .header(Attributes.AUTHORIZATION,
@@ -61,7 +61,7 @@
 
 
     @Test
-    public void testGetVirtualCollectionInfoById () {
+    public void testGetVirtualCollectionInfoById () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection").path("GOE-VC").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -77,7 +77,7 @@
     }
     
     @Test
-    public void testGetVirtualCollectionInfoByIdUnauthorized () {
+    public void testGetVirtualCollectionInfoByIdUnauthorized () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection").path("WPD15-VC").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -92,7 +92,7 @@
     }
     
     @Test
-    public void testGetPublicCorporaInfo () {
+    public void testGetPublicCorporaInfo () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -106,7 +106,7 @@
 
 
     @Test
-    public void testGetCorpusInfoById () {
+    public void testGetCorpusInfoById () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("WPD13").get(ClientResponse.class);
         
@@ -122,7 +122,7 @@
 
 
     @Test
-    public void testGetCorpusInfoById2 () {
+    public void testGetCorpusInfoById2 () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("GOE").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -136,7 +136,7 @@
 
 
     @Test
-    public void testGetPublicFoundriesInfo () {
+    public void testGetPublicFoundriesInfo () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("foundry").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -150,7 +150,7 @@
 
 
     @Test
-    public void testGetFoundryInfoById () {
+    public void testGetFoundryInfoById () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("foundry").path("tt").get(ClientResponse.class);
         String ent = response.getEntity(String.class);
@@ -164,7 +164,7 @@
 
 
     @Test
-    public void testGetUnexistingCorpusInfo () {
+    public void testGetUnexistingCorpusInfo () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("ZUW19").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
@@ -182,7 +182,7 @@
     // EM: queries for an unauthorized corpus get the same responses / treatment as 
     // asking for an unexisting corpus info. Does it need a specific exception instead?
     @Test
-    public void testGetUnauthorizedCorpusInfo () {
+    public void testGetUnauthorizedCorpusInfo () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("BRZ10").get(ClientResponse.class);
         assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index 0ccc272..3b6850b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -39,7 +39,7 @@
     // create a simple test collection for user kustvakt, otherwise test fails
     @Test
     @Ignore
-    public void testStats () {
+    public void testStats () throws KustvaktException{
         ClientResponse response = resource().path(getAPIVersion())
                 .path("collection")
                 .header(Attributes.AUTHORIZATION,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
index 1362f33..f40ba1b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
@@ -46,7 +46,7 @@
 
 
     @Test
-    public void testSearchQueryPublicCorpora () {
+    public void testSearchQueryPublicCorpora () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp")
@@ -68,7 +68,7 @@
 
 
     @Test
-    public void testSearchQueryWithMeta () {
+    public void testSearchQueryWithMeta () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("cutoff", "true")
@@ -89,7 +89,7 @@
     }
 
     @Test
-    public void testSearchQueryFreeExtern () {
+    public void testSearchQueryFreeExtern () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -111,7 +111,7 @@
     }
     
     @Test
-    public void testSearchQueryFreeIntern () {
+    public void testSearchQueryFreeIntern () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -134,7 +134,7 @@
     
     
     @Test
-    public void testSearchQueryExternAuthorized () {
+    public void testSearchQueryExternAuthorized () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -160,7 +160,7 @@
     }
 
     @Test
-    public void testSearchQueryInternAuthorized () {
+    public void testSearchQueryInternAuthorized () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -191,7 +191,7 @@
  // EM: shouldn't this case gets CorpusAccess.PUB ? 
     @Test
     @Ignore
-    public void testSearchQueryWithCollectionQueryAuthorizedWithoutIP () {
+    public void testSearchQueryWithCollectionQueryAuthorizedWithoutIP () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
@@ -221,7 +221,7 @@
     
     @Test
     @Ignore
-    public void testSearchQueryAuthorizedWithoutIP () {
+    public void testSearchQueryAuthorizedWithoutIP () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=die]")
                 .queryParam("ql", "poliqarp")
@@ -247,7 +247,7 @@
 
     @Test
     @Ignore
-    public void testSearchForPublicCorpusWithStringId () {
+    public void testSearchForPublicCorpusWithStringId () throws KustvaktException {
         ClientResponse response = resource()
                 .path("corpus").path("GOE").path("search")
                 .queryParam("q", "blau").queryParam("ql", "poliqarp")
@@ -273,7 +273,7 @@
 
     @Test
     @Ignore
-    public void testSearchForVirtualCollectionWithStringId () {
+    public void testSearchForVirtualCollectionWithStringId () throws KustvaktException{
         ClientResponse response = resource()
                 .path("collection").path("GOE-VC").path("search")
                 .queryParam("q", "blau").queryParam("ql", "poliqarp")
@@ -338,7 +338,7 @@
 
     @Test
     @Ignore
-    public void testSearchForCorpusWithStringIdUnauthorized () {
+    public void testSearchForCorpusWithStringIdUnauthorized () throws KustvaktException {
         ClientResponse response = resource()
                 .path("corpus").path("WPD15").path("search")
                 .queryParam("q", "blau").queryParam("ql", "poliqarp")
@@ -355,7 +355,7 @@
 
     @Test
     @Ignore
-    public void testSearchForSpecificCorpus () {
+    public void testSearchForSpecificCorpus () throws KustvaktException{
         ClientResponse response = resource()
                 .path("corpus").path("GOE").path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
@@ -423,7 +423,7 @@
 
 
     @Test
-    public void testSearchSentenceMeta () {
+    public void testSearchSentenceMeta () throws KustvaktException{
         ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -439,7 +439,7 @@
 
 
     @Test
-    public void testSearchSimpleCQL () {
+    public void testSearchSimpleCQL () throws KustvaktException{
         QuerySerializer s = new QuerySerializer();
         s.setQuery("(der) or (das)", "CQL");
 
@@ -457,7 +457,7 @@
 
 
     @Test
-    public void testSearchRawQuery () {
+    public void testSearchRawQuery () throws KustvaktException{
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[orth=der]", "poliqarp");
         s.setCollection("corpusSigle=GOE");
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchWithAvailabilityTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchWithAvailabilityTest.java
index 5427fd0..cbf1b3e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchWithAvailabilityTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchWithAvailabilityTest.java
@@ -22,7 +22,7 @@
 //        helper().runBootInterfaces();
     }
 
-    private void checkAndFree (String json) {
+    private void checkAndFree (String json) throws KustvaktException{
         JsonNode node = JsonUtils.readTree(json);
         assertEquals("availability",
                 node.at("/collection/operands/0/key").asText());
@@ -35,7 +35,7 @@
     }
 
 
-    private void checkAndPublic (String json) {
+    private void checkAndPublic (String json) throws KustvaktException{
         JsonNode node = JsonUtils.readTree(json);
         assertNotNull(node);
         assertEquals("operation:and",
@@ -58,7 +58,7 @@
                 node.at("/collection/rewrites/0/scope").asText());
     }
     
-    private void checkAndPublicWithoutACA (String json) {
+    private void checkAndPublicWithoutACA (String json) throws KustvaktException{
         JsonNode node = JsonUtils.readTree(json);
         assertNotNull(node);
         assertEquals("operation:and",
@@ -87,7 +87,7 @@
                 node.at("/collection/rewrites/0/scope").asText());
     }
     
-    private void checkAndAll (String json) {
+    private void checkAndAll (String json) throws KustvaktException{
         JsonNode node = JsonUtils.readTree(json);
         assertNotNull(node);
         assertEquals("availability(ALL)",
@@ -127,7 +127,7 @@
         
     }
 
-    private void checkAndAllWithoutACA (String json) {
+    private void checkAndAllWithoutACA (String json) throws KustvaktException{
         JsonNode node = JsonUtils.readTree(json);
         assertNotNull(node);
         assertEquals("operation:and",
@@ -172,7 +172,7 @@
 
 
     @Test
-    public void testAvailabilityFreeAuthorized () {
+    public void testAvailabilityFreeAuthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = CC-BY-SA");
 
@@ -184,7 +184,7 @@
 
 
     @Test
-    public void testAvailabilityRegexFreeAuthorized () {
+    public void testAvailabilityRegexFreeAuthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = /.*BY.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -195,7 +195,7 @@
 
 
     @Test
-    public void testAvailabilityFreeUnauthorized () {
+    public void testAvailabilityFreeUnauthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = ACA-NC");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -206,7 +206,7 @@
 
 
     @Test
-    public void testAvailabilityRegexFreeUnauthorized () {
+    public void testAvailabilityRegexFreeUnauthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = /ACA.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -216,7 +216,7 @@
     }
 
     @Test
-    public void testAvailabilityRegexNoRewrite () {
+    public void testAvailabilityRegexNoRewrite () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = /CC-BY.*/ & availability = /ACA.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -242,7 +242,7 @@
 
 
     @Test
-    public void testAvailabilityRegexFreeUnauthorized3 () {
+    public void testAvailabilityRegexFreeUnauthorized3 () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability = /.*NC.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -254,7 +254,7 @@
 
 
     @Test
-    public void testNegationAvailabilityFreeUnauthorized () {
+    public void testNegationAvailabilityFreeUnauthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability != /CC-BY.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -265,7 +265,7 @@
 
 
     @Test
-    public void testNegationAvailabilityFreeUnauthorized2 () {
+    public void testNegationAvailabilityFreeUnauthorized2 () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "availability != /.*BY.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -276,7 +276,7 @@
 
 
     @Test
-    public void testComplexNegationAvailabilityFreeUnauthorized () {
+    public void testComplexNegationAvailabilityFreeUnauthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "textClass=politik & availability != /CC-BY.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -287,7 +287,7 @@
 
 
     @Test
-    public void testComplexAvailabilityFreeUnauthorized () {
+    public void testComplexAvailabilityFreeUnauthorized () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "textClass=politik & availability=ACA-NC");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -298,7 +298,7 @@
 
 
     @Test
-    public void testComplexAvailabilityFreeUnauthorized3 () {
+    public void testComplexAvailabilityFreeUnauthorized3 () throws KustvaktException{
         ClientResponse response = builtSimpleClientResponse(
                 "textClass=politik & availability=/.*NC.*/");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -309,7 +309,7 @@
 
 
     @Test
-    public void testAvailabilityPublicAuthorized () {
+    public void testAvailabilityPublicAuthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability=ACA-NC", "149.27.0.32");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -320,7 +320,7 @@
 
 
     @Test
-    public void testAvailabilityPublicUnauthorized () {
+    public void testAvailabilityPublicUnauthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability=QAO-NC-LOC:ids", "149.27.0.32");
 
@@ -332,7 +332,7 @@
 
 
     @Test
-    public void testAvailabilityRegexPublicAuthorized () {
+    public void testAvailabilityRegexPublicAuthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability= /ACA.*/", "149.27.0.32");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -343,7 +343,7 @@
 
 
     @Test
-    public void testNegationAvailabilityPublicUnauthorized () {
+    public void testNegationAvailabilityPublicUnauthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability != ACA-NC", "149.27.0.32");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -354,7 +354,7 @@
 
 
     @Test
-    public void testNegationAvailabilityRegexPublicUnauthorized () {
+    public void testNegationAvailabilityRegexPublicUnauthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability != /ACA.*/", "149.27.0.32");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -365,7 +365,7 @@
 
 
     @Test
-    public void testComplexAvailabilityPublicUnauthorized () {
+    public void testComplexAvailabilityPublicUnauthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "textClass=politik & availability=QAO-NC-LOC:ids",
                 "149.27.0.32");
@@ -378,7 +378,7 @@
 
 
     @Test
-    public void testNegationComplexAvailabilityPublicUnauthorized () {
+    public void testNegationComplexAvailabilityPublicUnauthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "textClass=politik & availability!=QAO-NC-LOC:ids",
                 "149.27.0.32");
@@ -390,7 +390,7 @@
     }
 
     @Test
-    public void testAvailabilityRegexAllAuthorized () {
+    public void testAvailabilityRegexAllAuthorized () throws KustvaktException{
         ClientResponse response = builtClientResponseWithIP(
                 "availability= /ACA.*/", "10.27.0.32");
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
index 4c84a67..b754d26 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
@@ -60,7 +60,7 @@
 	}
 
 	@Test
-	public void testRegisterMissingFields() {
+	public void testRegisterMissingFields() throws KustvaktException{
 
 		MultivaluedMap map = new MultivaluedMapImpl();
 		map.putSingle("username", "testuser"); // bodmer funktioniert noch nicht
@@ -114,7 +114,7 @@
 
 	// should be run over https, since password is transmitted in plain text
 	@Test
-	public void testRegisterAndConfirm() {
+	public void testRegisterAndConfirm() throws KustvaktException{
 		MultivaluedMap map = new MultivaluedMapImpl();
 		map.putSingle("username", "testuser");
 		map.putSingle("email", "hanl@ids-mannheim.de");
@@ -154,7 +154,7 @@
 	// EM: This test require VPN / IDS Intranet
 	@Test
 	@Ignore
-	public void loginJWT() {
+	public void loginJWT() throws KustvaktException{
 		String en = BasicHttpAuth.encode(credentials[0], credentials[1]);
 		/* lauffähige Version von Hanl: */
 		ClientResponse response = resource().path("auth").path("apiToken")
@@ -238,7 +238,7 @@
 	}
 
 	@Test
-	public void testUpdateUserDetailsMerge() {
+	public void testUpdateUserDetailsMerge() throws KustvaktException{
 		String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
 		Map m = new LinkedMap();
 		m.put("test", "test value 1");
@@ -294,7 +294,7 @@
 	}
 
 	@Test
-	public void testUpdateUserDetailsJson() {
+	public void testUpdateUserDetailsJson() throws KustvaktException{
 		String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
 		Map m = new LinkedMap();
 		m.put("firstName", "newName");
@@ -329,7 +329,7 @@
 
 	@Test
 	@Ignore
-	public void testUpdateUserSettingsForm() throws IOException {
+	public void testUpdateUserSettingsForm() throws IOException, KustvaktException{
 		String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
 		MultivaluedMap m = new MultivaluedMapImpl();
 		m.putSingle("queryLanguage", "poliqarp_test");
@@ -367,7 +367,7 @@
 	}
 
 	@Test
-	public void testUpdateUserSettingsJson() throws IOException {
+	public void testUpdateUserSettingsJson() throws IOException, KustvaktException {
 		String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
 		Map m = new HashMap<>();
 		m.put("queryLanguage", "poliqarp_test");
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index c5c47af..43cc494 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -160,6 +160,11 @@
 	<bean id="kustvakt_auditing" class="de.ids_mannheim.korap.handlers.JDBCAuditing">
 		<constructor-arg ref="kustvakt_db" />
 	</bean>
+	
+	<bean id="kustvakt_response"
+          class="de.ids_mannheim.korap.web.utils.KustvaktResponseHandler">
+          <constructor-arg index="0" name="iface" ref="kustvakt_auditing"/>
+    </bean>
 
 	<bean id="kustvakt_userdb" class="de.ids_mannheim.korap.handlers.EntityDao">
 		<constructor-arg ref="kustvakt_db" />