Search in sources :

Example 1 with AuthenticationDAO

use of org.activityinfo.server.database.hibernate.dao.AuthenticationDAO in project activityinfo by bedatadriven.

the class ConfirmInviteControllerTest method setup.

@Before
public final void setup() {
    user = new User();
    userDAO = createMock(UserDAO.class);
    expect(userDAO.findUserByChangePasswordKey(eq(VALID_KEY))).andReturn(user);
    expect(userDAO.findUserByChangePasswordKey(EasyMock.not(eq(VALID_KEY)))).andThrow(new NoResultException());
    replay(userDAO);
    AuthenticationDAO authDAO = createMock(AuthenticationDAO.class);
    authDAO.persist(isA(Authentication.class));
    expectLastCall().anyTimes();
    MailingListClient mailingListClient = createNiceMock(MailingListClient.class);
    replay(mailingListClient);
    AuthTokenProvider authTokenProvider = new AuthTokenProvider(Providers.of(authDAO));
    resource = new ConfirmInviteController(Providers.of(userDAO), authTokenProvider, mailingListClient);
}
Also used : MailingListClient(org.activityinfo.server.util.MailingListClient) User(org.activityinfo.server.database.hibernate.entity.User) UserDAO(org.activityinfo.server.database.hibernate.dao.UserDAO) Authentication(org.activityinfo.server.database.hibernate.entity.Authentication) AuthenticationDAO(org.activityinfo.server.database.hibernate.dao.AuthenticationDAO) NoResultException(javax.persistence.NoResultException) AuthTokenProvider(org.activityinfo.server.authentication.AuthTokenProvider) Before(org.junit.Before)

Aggregations

NoResultException (javax.persistence.NoResultException)1 AuthTokenProvider (org.activityinfo.server.authentication.AuthTokenProvider)1 AuthenticationDAO (org.activityinfo.server.database.hibernate.dao.AuthenticationDAO)1 UserDAO (org.activityinfo.server.database.hibernate.dao.UserDAO)1 Authentication (org.activityinfo.server.database.hibernate.entity.Authentication)1 User (org.activityinfo.server.database.hibernate.entity.User)1 MailingListClient (org.activityinfo.server.util.MailingListClient)1 Before (org.junit.Before)1