@@ -0,0 +1,1688 @@
+package org.jvalue.commons.auth;%0A%0Aimport org.ektorp.DocumentNotFoundException;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0Aimport mockit.Expectations;%0Aimport mockit.Mocked;%0Aimport mockit.Verifications;%0Aimport mockit.integration.junit4.JMockit;%0A%0A@RunWith(JMockit.class)%0Apublic final class UserManagerTest %7B%0A%0A%09@Mocked private UserRepository userRepository;%0A%09@Mocked private BasicCredentialsRepository credentialsRepository;%0A%09private final BasicAuthenticationUtils authenticationUtils = new BasicAuthenticationUtils();%0A%0A%09private UserManager userManager;%0A%0A%09@Before%0A%09public void setupManager() %7B%0A%09%09userManager = new UserManager(userRepository, credentialsRepository, authenticationUtils);%0A%09%7D%0A%0A%0A%09@Test%0A%09public void testContains() throws Exception %7B%0A%09%09final String mail1 = %22someMail1%22;%0A%09%09final String mail2 = %22someMail2%22;%0A%0A%09%09new Expectations() %7B%7B%0A%09%09%09userRepository.findByEmail(mail1); result = new User(%22%22, %22%22, %22%22, Role.ADMIN);%0A%09%09%09userRepository.findByEmail(mail2); result = new DocumentNotFoundException(%22%22);%0A%09%09%7D%7D;%0A%0A%09%09Assert.assertTrue(userManager.contains(mail1));%0A%09%09Assert.assertFalse(userManager.contains(mail2));%0A%09%7D%0A%0A%0A%09@Test%0A%09public void testAdd() throws Exception %7B%0A%09%09UserDescription description = new UserDescription(%22someName%22, %22someMail%22, Role.ADMIN, %22somePass%22);%0A%09%09final User user = userManager.add(description);%0A%0A%09%09Assert.assertEquals(user.getName(), description.getName());%0A%09%09Assert.assertEquals(user.getEmail(), description.getEmail());%0A%09%09Assert.assertEquals(user.getRole(), description.getRole());%0A%0A%09%09new Verifications() %7B%7B%0A%09%09%09userRepository.add(user);%0A%09%09%09credentialsRepository.add((BasicCredentials) any);%0A%09%09%7D%7D;%0A%09%7D%0A%0A%7D

add UserManagerTest