PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/server/dao/hibernate/UserDAOImplTest.java

http://sigma-h.googlecode.com/
Java | 52 lines | 37 code | 11 blank | 4 comment | 0 complexity | 0edf25e4c581459edc140eca0a225c53 MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.server.dao.hibernate;
 7
 8import com.google.inject.Inject;
 9import org.junit.Test;
10import org.junit.runner.RunWith;
11import org.sigmah.server.dao.OnDataSet;
12import org.sigmah.shared.dao.UserDAO;
13import org.sigmah.shared.domain.User;
14import org.sigmah.test.InjectionSupport;
15import org.sigmah.test.MockHibernateModule;
16import org.sigmah.test.Modules;
17
18import static org.junit.Assert.*;
19
20@RunWith(InjectionSupport.class)
21@Modules({MockHibernateModule.class})
22@OnDataSet("/dbunit/schema1.db.xml")
23public class UserDAOImplTest {
24
25    private UserDAO userDAO;
26
27    @Inject
28    public UserDAOImplTest(UserDAOImpl userDAO) {
29        this.userDAO = userDAO;
30    }
31
32    @Test
33    public void testDoesUserExist() throws Exception {
34        assertTrue(userDAO.doesUserExist("bavon@nrcdrc.org"));
35    }
36
37    @Test
38    public void testDoesUserExistWhenNoUser() throws Exception {
39        assertFalse(userDAO.doesUserExist("nonexistantuser@solidarites.org"));
40    }
41
42    @Test
43    public void testFindUserByEmail() throws Exception {
44        User user = userDAO.findUserByEmail("bavon@nrcdrc.org");
45
46        assertEquals("id", 2, user.getId());
47    }
48
49    @Test
50    public void testFindUserByChangePasswordKey() throws Exception {
51    }
52}