Skip to content
Snippets Groups Projects
Commit 088dff87 authored by srosse's avatar srosse
Browse files

OO-2936: add unit tests

parent c366bd8f
No related branches found
No related tags found
No related merge requests found
......@@ -121,6 +121,32 @@ public class UserManagerTest extends OlatTestCase {
Assert.assertTrue(identities.contains(id2));
}
@Test
public void findUserKeyWithProperty() {
//create a user
Identity id = createUser(UUID.randomUUID().toString());
dbInstance.commitAndCloseSession();
String institutionalEmail = id.getUser().getProperty(UserConstants.INSTITUTIONALEMAIL, null);
List<Long> identityKeys = userManager.findUserKeyWithProperty(UserConstants.INSTITUTIONALEMAIL, institutionalEmail);
Assert.assertNotNull(identityKeys);
Assert.assertEquals(1, identityKeys.size());
Assert.assertEquals(id.getUser().getKey(), identityKeys.get(0));
}
@Test
public void findIdentitiesWithProperty() {
//create a user
Identity id = createUser(UUID.randomUUID().toString());
dbInstance.commitAndCloseSession();
String institutionalEmail = id.getUser().getProperty(UserConstants.INSTITUTIONALEMAIL, null);
List<Identity> identities = userManager.findIdentitiesWithProperty(UserConstants.INSTITUTIONALEMAIL, institutionalEmail);
Assert.assertNotNull(identities);
Assert.assertEquals(1, identities.size());
Assert.assertEquals(id, identities.get(0));
}
private Identity createUser(String uuid) {
String username = "createid-" + uuid;
String email = username + "@frentix.com";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment