Fixed OAuth2 tests

Change-Id: I557cd94495214fbeda1a917c0125bf5fb545e3f8
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
index 858b6cb..5389c94 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
@@ -50,6 +50,7 @@
     @Autowired
     private OAuth2ClientDao clientDao;
     
+    private String testUsername = "idsTestUser";
     private String testUserEmail = "testuser@example.com";
     private String redirectUri = "https://client.com/redirect";
 
@@ -94,20 +95,20 @@
     }
 
     @Test
-    public void testMapUsernameToEmail () throws KustvaktException {
+    public void testMapEmailToUsername () throws KustvaktException {
         Response response = requestTokenWithPassword(superClientId,
-                clientSecret, "testUser", "password");
+                clientSecret, testUserEmail, "password");
         JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         
         String accessToken = node.at("/access_token").asText();
         AccessToken accessTokenObj = accessDao.retrieveAccessToken(accessToken);
-        assertEquals(testUserEmail, accessTokenObj.getUserId());
+        assertEquals(testUsername, accessTokenObj.getUserId());
 
         String refreshToken = node.at("/refresh_token").asText();
         RefreshToken rt = refreshDao.retrieveRefreshToken(refreshToken);
-        assertEquals(testUserEmail, rt.getUserId());
+        assertEquals(testUsername, rt.getUserId());
         
         testRegisterPublicClient(accessToken);
         node = testRegisterConfidentialClient(accessToken);
@@ -138,7 +139,7 @@
 
         String clientId = node.at("/client_id").asText();
         OAuth2Client client = clientDao.retrieveClientById(clientId);
-        assertEquals(testUserEmail, client.getRegisteredBy());
+        assertEquals(testUsername, client.getRegisteredBy());
     }
     
     private JsonNode testRegisterConfidentialClient (String accessToken)
@@ -163,7 +164,7 @@
 
         String clientId = node.at("/client_id").asText();
         OAuth2Client client = clientDao.retrieveClientById(clientId);
-        assertEquals(testUserEmail, client.getRegisteredBy());
+        assertEquals(testUsername, client.getRegisteredBy());
         return node;
     }
     
@@ -193,10 +194,10 @@
 
         String at = node.at("/access_token").asText();
         AccessToken accessTokenObj = accessDao.retrieveAccessToken(at);
-        assertEquals(testUserEmail, accessTokenObj.getUserId());
+        assertEquals(testUsername, accessTokenObj.getUserId());
 
         String refreshToken = node.at("/refresh_token").asText();
         RefreshToken rt = refreshDao.retrieveRefreshToken(refreshToken);
-        assertEquals(testUserEmail, rt.getUserId());
+        assertEquals(testUsername, rt.getUserId());
     }
 }