use of org.summerb.users.impl.dao.AuthTokenDao in project summerb by skarpushin.
the class AuthTokenServiceDbImplFactory method createAuthTokenServiceDbImpl.
public static AuthTokenServiceImpl createAuthTokenServiceDbImpl() {
AuthTokenServiceImpl ret = new AuthTokenServiceImpl();
ret.setPasswordService(PasswordServiceDbImplFactory.createPasswordServiceDbImpl());
ret.setUserService(UserServiceImplFactory.createUsersServiceImpl());
AuthTokenDao authTokenDao = Mockito.mock(AuthTokenDao.class);
ret.setAuthTokenDao(authTokenDao);
when(authTokenDao.findAuthTokenByUuid(AuthTokenFactory.AUTH_TOKEN_EXCEPTION)).thenThrow(new IllegalStateException("test simulate exception"));
when(authTokenDao.findAuthTokenByUuid(AuthTokenFactory.AUTH_TOKEN_EXISTENT)).thenReturn(AuthTokenFactory.createAuthTokenForExistentUser());
when(authTokenDao.findAuthTokenByUuid(AuthTokenFactory.AUTH_TOKEN_NOT_EXISTENT)).thenReturn(null);
when(authTokenDao.findAuthTokenByUuid(AuthTokenFactory.AUTH_TOKEN_EXPIRED)).thenReturn(AuthTokenFactory.createExpiredAuthToken());
List<AuthToken> expiredTokens = new LinkedList<AuthToken>();
expiredTokens.add(AuthTokenFactory.createExpiredAuthToken());
PaginatedList<AuthToken> expiredAuthTokens = new PaginatedList<AuthToken>(new PagerParams(), expiredTokens, 1);
return ret;
}
Aggregations