diff --git a/full/Changes b/full/Changes
index 7648ee3..92c154e 100644
--- a/full/Changes
+++ b/full/Changes
@@ -2,6 +2,7 @@
 
 - Removed auditing (#611)
 - Removed old database configurations (#612)
+- Removed old tests
 
 # version 0.70.1
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/config/BeanConfigTest.java b/full/src/test/java/de/ids_mannheim/korap/config/BeanConfigTest.java
deleted file mode 100644
index 3b308b0..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/config/BeanConfigTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package de.ids_mannheim.korap.config;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.junit.runner.RunWith;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.model.InitializationError;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import net.jcip.annotations.NotThreadSafe;
-
-/**
- * @author hanl
- * @date 09/03/2016
- */
-@NotThreadSafe
-@RunWith(BeanConfigTest.SpringExtendedSetupListener.class)
-@ContextConfiguration("classpath:test-config.xml")
-@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
-public abstract class BeanConfigTest {
-
-    private static Logger jlog = LogManager.getLogger(BeanConfigTest.class);
-    @Autowired
-    protected ApplicationContext context;
-
-    public void init () throws Exception {
-        assertNotNull("Application context must not be null!", this.context);
-        jlog.debug("running one-time before init for class "
-                + this.getClass().getSimpleName() + " ...");
-//        BeansFactory.setKustvaktContext(getContext());
-        assertNotNull(BeansFactory.getKustvaktContext());
-    }
-
-    public void close () {
-        BeansFactory.closeApplication();
-    }
-
-    public static class SpringExtendedSetupListener
-            extends SpringJUnit4ClassRunner {
-
-        private BeanConfigTest instanceSetupListener;
-
-
-        public SpringExtendedSetupListener (Class<?> clazz)
-                throws InitializationError {
-            super(clazz);
-        }
-
-
-        @Override
-        protected Object createTest () throws Exception {
-            Object test = super.createTest();
-            // Note that JUnit4 will call this createTest() multiple times for each
-            // test method, so we need to ensure to call "beforeClassSetup" only once.
-            if (test instanceof BeanConfigTest
-                    && instanceSetupListener == null) {
-                instanceSetupListener = (BeanConfigTest) test;
-                instanceSetupListener.init();
-            }
-            return test;
-        }
-
-
-        @Override
-        public void run (RunNotifier notifier) {
-            super.run(notifier);
-            if (instanceSetupListener != null) {
-                instanceSetupListener.close();
-            }
-        }
-    }
-
-//    protected ContextHolder getContext () {
-//        return helper().getContext();
-//    }
-//
-//    protected TestHelper helper () {
-//        try {
-//            return TestHelper.newInstance(this.context);
-//        }
-//        catch (Exception e) {
-//            return null;
-//        }
-//    }
-}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java
deleted file mode 100644
index ae9a2ef..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package de.ids_mannheim.korap.web;
-
-import java.net.URI;
-import java.util.concurrent.ThreadLocalRandom;
-
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.UriBuilder;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.springframework.web.context.ContextLoaderListener;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.servlet.ServletContainer;
-import org.glassfish.jersey.test.DeploymentContext;
-import org.glassfish.jersey.test.ServletDeploymentContext;
-import org.glassfish.jersey.test.spi.TestContainer;
-import org.glassfish.jersey.test.spi.TestContainerFactory;
-import org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory;
-import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
-
-import de.ids_mannheim.korap.config.BeanConfigTest;
-
-public abstract class FastJerseyTest extends BeanConfigTest{
-
-    private static String[] classPackages =
-            new String[] { "de.ids_mannheim.korap.web.service.full",
-                    "de.ids_mannheim.korap.web.filter",
-                    "de.ids_mannheim.korap.web.utils" };
-
-    public final static String API_VERSION = "v0.1";
-
-    private static ResourceConfig resourceConfig =
-            new ResourceConfig();
-
-    private static TestContainerFactory testContainerFactory;
-
-    protected static TestContainer testContainer;
-
-    protected static javax.ws.rs.client.Client client;
-
-    protected static int PORT = 8089; // FB, was: 9000;
-    protected static int PORT_IT = 1;
-    protected static String containerURI = "http://localhost/";
-
-    public String getAPIVersion () {
-        return API_VERSION;
-    }
-
-    public static void setTestContainerFactory (
-            TestContainerFactory newTestContainerFactory) {
-        testContainerFactory = newTestContainerFactory;
-    }
-
-
-    @BeforeClass
-    public static void cleanStaticVariables () {
-        resourceConfig = new ResourceConfig();
-    }
-
-
-    protected static void initServer (int port, String[] classPackages) {
-        DeploymentContext dc;
-        if (classPackages == null)
-            dc = DeploymentContext.builder(resourceConfig).build();
-        else
-            dc = ServletDeploymentContext
-                    .forServlet(new ServletContainer(resourceConfig.packages(classPackages)))
-                    .addListener(ContextLoaderListener.class)
-                    .contextParam("contextConfigLocation", "classpath:test-config.xml")
-                    .build();
-
-        TestContainerFactory tcf = testContainerFactory;
-        if (tcf == null) {
-            if (classPackages == null)
-                tcf = new GrizzlyTestContainerFactory();
-            else
-                tcf = new GrizzlyWebTestContainerFactory();
-        }
-
-        testContainer = tcf.create(
-                UriBuilder.fromUri(containerURI).port(port).build(), dc);
-        client = testContainer.getClientConfig().getClient();
-        if (client == null) {
-            client = ClientBuilder.newClient(testContainer.getClientConfig());
-        }
-    }
-
-    @After
-    public void stopServer () {
-        
-        testContainer.stop();
-        testContainer = null;
-        client = null;
-    }
-
-
-    public Client client () {
-        return client;
-    }
-
-
-    public URI getBaseUri () {
-        return testContainer.getBaseUri();
-    }
-
-
-    public WebTarget target () {
-        return client.target(getBaseUri());
-    }
-    
-//    protected TestHelper helper () {
-//        try {
-//            return TestHelper.newInstance(this.context);
-//        }
-//        catch (Exception e) {
-//            return null;
-//        }
-//    }
-//
-//
-//    @Override
-//    protected ContextHolder getContext () {
-//        return helper().getContext();
-//    }
-
-
-    public static void startServer () {
-        try {
-            if (testContainer != null) {
-                testContainer.start();
-            }
-        }
-        catch (Exception e) {
-            initServer(PORT + PORT_IT++, classPackages);
-            startServer();
-        }
-    }
-
-
-    @Before
-    public void startServerBeforeFirstTestRun () {
-        if (testContainer == null) {
-            int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
-            initServer(port, classPackages);
-            startServer();
-        }
-    }
-
-}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
deleted file mode 100644
index 8ebe6a6..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package de.ids_mannheim.korap.web.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.joda.time.DateTime;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
-import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.TimeUtils;
-import de.ids_mannheim.korap.web.FastJerseyTest;
-
-/**
- * EM: fix tests. New DB does not save users.
- * @author hanl
- * @date 24/09/2015
- */
-@Ignore
-public class AuthenticationControllerTest extends FastJerseyTest {
-
-    private static String[] credentials;
-    
-    @Test
-    public void testSessionToken() throws KustvaktException {
-        String auth = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue( 
-                credentials[0], credentials[1]);
-        Response response = target().path("auth")
-                .path("sessionToken")
-                .request()
-                .header(Attributes.AUTHORIZATION, auth)
-                .get();
-        assertEquals(Status.OK.getStatusCode(),
-                response.getStatus());
-        String en = response.readEntity(String.class);
-        JsonNode node = JsonUtils.readTree(en);
-        assertNotNull(node);
-
-        String token = node.path("token").asText();
-        String token_type = node.path("token_type").asText();
-        String expiration = node.path("expires").asText();
-        DateTime ex = TimeUtils.getTime(expiration);
-        assertNotEquals("", token);
-        assertNotEquals("", token_type);
-        assertFalse(TimeUtils.isExpired(ex.getMillis()));
-
-        response = target().path("user")
-                .path("info")
-                .request()
-                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get();
-        en = response.readEntity(String.class);
-
-        assertEquals(Status.OK.getStatusCode(),
-                response.getStatus());
-        
-        response = target().path("auth")
-                .path("logout")
-                .request()
-                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get();
-        
-        assertEquals(Status.OK.getStatusCode(),
-                response.getStatus());
-    }
-
-    @Test
-    public void testSessionTokenExpire() throws KustvaktException {
-        String auth = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(
-                credentials[0], credentials[1]);
-        Response response = target().path("auth")
-                .path("sessionToken")
-                .request()
-                .header(Attributes.AUTHORIZATION, auth)
-                .get();
-        assertEquals(Status.OK.getStatusCode(),
-                response.getStatus());
-        String en = response.readEntity(String.class);
-        JsonNode node = JsonUtils.readTree(en);
-        assertNotNull(node);
-
-        String token = node.path("token").asText();
-        String token_type = node.path("token_type").asText();
-        String expiration = node.path("expires").asText();
-        DateTime ex = TimeUtils.getTime(expiration);
-        assertNotEquals("", token);
-        assertNotEquals("", token_type);
-
-        while (true) {
-            if (TimeUtils.isExpired(ex.getMillis()))
-                break;
-        }
-        response = target().path("user")
-                .path("info")
-                .request()
-                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get();
-        en = response.readEntity(String.class);
-        node = JsonUtils.readTree(en);
-        assertNotNull(node);
-
-        assertEquals(StatusCodes.BAD_CREDENTIALS, node.at("/errors/0/0").asInt());
-        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
-                response.getStatus());
-    }
-
-
-//    @Test
-//    public void testBlockingFilterFail() {
-//
-//    }
-//
-//
-//    @Test
-//    public void testBasicLogout () {
-//
-//    }
-//
-//
-//    @Test
-//    public void testSessionTokenLogin () {
-//
-//    }
-//
-//
-//    @Test
-//    public void testSessionTokenLogout () {
-//
-//    }
-//
-//
-//    @Test
-//    public void testOpenIDLogin () {
-//
-//    }
-//
-//
-//    @Test
-//    public void testOpenIDLogout () {
-//
-//    }
-//
-//
-//    // -- are these even right? auth - authorization
-//    @Test
-//    public void testOAuth2Login () {
-//
-//    }
-//
-//
-//    @Test
-//    public void testOAuth2Logout () {
-//
-//    }
-
-    //todo: test basicauth via secure connection
-
-}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
index 87fd5bd..23c7257 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
@@ -13,24 +13,24 @@
 import java.util.Iterator;
 
 import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 
 import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.FastJerseyTest;
 
 
 // EM: The API is disabled
 @Ignore
-public class QuerySerializationControllerTest extends FastJerseyTest {
+public class QuerySerializationControllerTest extends SpringJerseyTest {
 
     @Test
     public void testQuerySerializationFilteredPublic ()
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
index 53a9957..7e9fba6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
@@ -5,19 +5,19 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 
 import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.FastJerseyTest;
 
 /**
  * @author hanl, margaretha
@@ -25,11 +25,11 @@
  *             EM: FIX ME: Database restructure
  */
 @Ignore
-public class ResourceInfoControllerTest extends FastJerseyTest {
+public class ResourceInfoControllerTest extends SpringJerseyTest {
 
     @Test
     public void testGetPublicVirtualCollectionInfo () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("collection")
                 .request()
                 .get();
@@ -45,7 +45,7 @@
     @Test
     public void testGetVirtualCollectionInfoWithAuthentication ()
             throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("collection")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -65,7 +65,7 @@
 
     @Test
     public void testGetVirtualCollectionInfoById () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("collection").path("GOE-VC")
                 .request()
                 .get();
@@ -83,7 +83,7 @@
     @Test
     public void testGetVirtualCollectionInfoByIdUnauthorized ()
             throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("collection").path("WPD15-VC")
                 .request()
                 .get();
@@ -101,7 +101,7 @@
 
     @Test
     public void testGetPublicCorporaInfo () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("corpus")
                 .request()
                 .get();
@@ -117,7 +117,7 @@
 
     @Test
     public void testGetCorpusInfoById () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("corpus").path("WPD13")
                 .request()
                 .get();
@@ -135,7 +135,7 @@
 
     @Test
     public void testGetCorpusInfoById2 () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("corpus").path("GOE")
                 .request()
                 .get();
@@ -151,7 +151,7 @@
 
     @Test
     public void testGetPublicFoundriesInfo () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("foundry")
                 .request()
                 .get();
@@ -167,7 +167,7 @@
 
     @Test
     public void testGetFoundryInfoById () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("foundry").path("tt")
                 .request()
                 .get();
@@ -183,7 +183,7 @@
 
     @Test
     public void testGetUnexistingCorpusInfo () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("corpus").path("ZUW19")
                 .request()
                 .get();
@@ -205,7 +205,7 @@
     // exception instead?
     @Test
     public void testGetUnauthorizedCorpusInfo () throws KustvaktException {
-        Response response = target().path(getAPIVersion())
+        Response response = target().path(API_VERSION)
                 .path("corpus").path("BRZ10")
                 .request()
                 .get();
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
deleted file mode 100644
index 1259041..0000000
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
+++ /dev/null
@@ -1,357 +0,0 @@
-package de.ids_mannheim.korap.web.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Form;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response.Status;
-
-import org.apache.commons.collections.map.LinkedMap;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jwt.SignedJWT;
-import javax.ws.rs.core.Response;
-
-import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
-import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.config.BeansFactory;
-import de.ids_mannheim.korap.config.FullConfiguration;
-import de.ids_mannheim.korap.config.JWTSigner;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.TimeUtils;
-import de.ids_mannheim.korap.web.FastJerseyTest;
-
-/** EM: To do: not implemented in the new DB yet
- * @author hanl
- * @date 21/03/2015
- */
-
-// todo: do benchmarks for simple request to check access_token check and user
-// retrieval!
-@Ignore
-public class ShibbolethUserControllerTest extends FastJerseyTest {
-
-    @Autowired
-    FullConfiguration config;
-	private static String[] credentials;
-
-	@Test
-	public void loginHTTP() throws KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Response response = target().path("user").path("info")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-	}
-
-	// EM: This test require VPN / IDS Intranet
-	@Test
-	@Ignore
-	public void loginJWT() throws KustvaktException{
-		String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		/* lauffähige Version von Hanl: */
-		Response response = target().path("auth").path("apiToken")
-				.request()
-				.header(Attributes.AUTHORIZATION, en).get();
-		/**/
-		/*
-		 * Test : Response response = null; WebResource webRes =
-		 * target().path("auth") .path("apiToken");
-		 * webRes.header(Attributes.AUTHORIZATION, en);
-		 * 
-		 * System.out.printf("resource: " + webRes.toString());
-		 * 
-		 * response = webRes.get();
-		 * 
-		 */
-
-//		assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-		String entity = response.readEntity(String.class);
-//		System.out.println(entity);
-		JsonNode node = JsonUtils.readTree(entity);
-		assertEquals(2022, node.at("/errors/0/0").asInt());
-	}
-
-	// EM: cannot do test with LDAP
-	@Test
-	@Ignore
-	public void loginJWTExpired() throws InterruptedException, KustvaktException, ParseException, JOSEException {
-
-		assertTrue(BeansFactory.getKustvaktContext().getConfiguration().getTokenTTL() < 10);
-
-		String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Response response = target().path("auth").path("apiToken")
-				.request()
-				.header(Attributes.AUTHORIZATION, en).get();
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(node);
-		String token = node.path("token").asText();
-
-		JWTSigner sign = new JWTSigner(BeansFactory.getKustvaktContext().getConfiguration().getSharedSecret(),
-				config.getIssuer(), -1);
-		        //BeansFactory.getKustvaktContext().getConfiguration().getIssuer(), -1);
-		SignedJWT jwt = sign.verifyToken(token);
-
-		while (true) {
-			if (TimeUtils.isExpired(jwt.getJWTClaimsSet().getExpirationTime().getTime()))
-				break;
-		}
-
-		response = target().path("user").path("info")
-				.request()
-				.header(Attributes.AUTHORIZATION, "api_token " + token).get();
-		assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
-
-	}
-
-	@Test
-	public void testGetUserDetails() throws KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Response response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-	}
-
-	@Test
-	public void testGetUserDetailsEmbeddedPointer() throws KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Map m = new LinkedMap();
-		m.put("test", "[100, \"error message\", true, \"another message\"]");
-
-		Response response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(Entity.json(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("details").queryParam("pointer", "test")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.readEntity(String.class);
-		assertEquals("[100, \"error message\", true, \"another message\"]", ent);
-	}
-
-	@Test
-	public void testUpdateUserDetailsMerge() throws KustvaktException{
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Map m = new LinkedMap();
-		m.put("test", "test value 1");
-
-		Response response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(Entity.json(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.readEntity(String.class);
-		JsonNode node = JsonUtils.readTree(ent);
-		assertNotNull(node);
-		assertEquals("test value 1", node.at("/test").asText());
-		assertEquals("user", node.at("/lastName").asText());
-		assertEquals("test@ids-mannheim.de", node.at("/email").asText());
-	}
-
-	@Test
-	public void testGetUserDetailsPointer() throws KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Response response = target().path("user").path("details")
-				.queryParam("pointer", "email")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.readEntity(String.class);
-		assertEquals("test@ids-mannheim.de", ent);
-	}
-
-	@Test
-	public void testGetUserDetailsNonExistent() throws KustvaktException {
-//		helper().setupSimpleAccount("userservicetest", "servicepass");
-
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue("userservicetest", "servicepass");
-		Response response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-		String entity = response.readEntity(String.class);
-		JsonNode node = JsonUtils.readTree(entity);
-		assertNotNull(node);
-		assertEquals(StatusCodes.NO_RESOURCE_FOUND, node.at("/errors/0/0").asInt());
-		assertEquals("UserDetails", node.at("/errors/0/2").asText());
-	}
-
-	@Test
-	public void testGetUserSettings() throws KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Response response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-	}
-
-	@Test
-	public void testUpdateUserDetailsJson() throws KustvaktException{
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Map m = new LinkedMap();
-		m.put("firstName", "newName");
-		m.put("lastName", "newLastName");
-		m.put("email", "newtest@ids-mannheim.de");
-
-		Response response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(Entity.json(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.get();
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-		JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(node);
-		assertEquals("newName", node.path("firstName").asText());
-		assertEquals("newLastName", node.path("lastName").asText());
-		assertEquals("newtest@ids-mannheim.de", node.path("email").asText());
-		assertEquals("Mannheim", node.path("address").asText());
-
-		m = new LinkedMap();
-		m.put("firstName", "test");
-		m.put("lastName", "user");
-		m.put("email", "test@ids-mannheim.de");
-
-		response = target().path("user").path("details")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(Entity.json(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-	}
-
-	@Test
-	@Ignore
-	public void testUpdateUserSettingsForm() throws IOException, KustvaktException{
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Form m = new Form();
-		m.param("queryLanguage", "poliqarp_test");
-		m.param("pageLength", "200");
-
-		Response response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", "application/x-www-form-urlencodeBase64d")
-				.get();
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		JsonNode map = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(map);
-
-		assertNotEquals(m.asMap().getFirst("queryLanguage"), map.get("queryLanguage"));
-		assertNotEquals(m.asMap().get("pageLength"), Integer.valueOf((String) m.asMap().getFirst("pageLength")));
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", "application/x-www-form-urlencodeBase64d")
-				.post(Entity.form(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", "application/x-www-form-urlencodeBase64d").get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		map = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(map);
-
-		assertEquals(map.get("queryLanguage"), m.asMap().getFirst("queryLanguage"));
-		int p1 = map.path("pageLength").asInt();
-		int p2 = Integer.valueOf((String) m.asMap().getFirst("pageLength"));
-		assertEquals(p1, p2);
-	}
-
-	@Test
-	public void testUpdateUserSettingsJson() throws IOException, KustvaktException {
-		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		Map m = new HashMap<>();
-		m.put("queryLanguage", "poliqarp_test");
-		m.put("pageLength", "200");
-		m.put("setting_1", "value_1");
-
-		Response response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.get();
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		JsonNode map = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(map);
-
-		assertNotEquals(m.get("queryLanguage"), map.get("queryLanguage"));
-		assertNotEquals(m.get("pageLength"), Integer.valueOf((String) m.get("pageLength")));
-
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(Entity.json(m));
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		response = target().path("user").path("settings")
-				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.get();
-		assertEquals(Status.OK.getStatusCode(), response.getStatus());
-
-		map = JsonUtils.readTree(response.readEntity(String.class));
-		assertNotNull(map);
-
-		assertEquals(map.path("queryLanguage").asText(), m.get("queryLanguage"));
-		int p1 = map.path("pageLength").asInt();
-		int p2 = Integer.valueOf((String) m.get("pageLength"));
-		assertEquals(p1, p2);
-	}
-
-	@Test
-	public void testLoginFailedLockAccount() {
-
-	}
-
-	@Test
-	public void delete() {
-
-	}
-
-}
