@Test public void testSearchByName_notFound() { String search = "not found string"; executeClassSql(); List<User> users = userDAO.searchByName(search); assertEquals(0, users.size()); }
@Test public void testSearchByName() { String search = "full"; executeClassSql(); List<User> users = userDAO.searchByName(search); assertEquals(1, users.size()); }
@Test public void testListUsersByEnabledStatus_disabled() { executeClassSql(); List<User> users = userDAO.listUsersByEnabledStatus(false); assertEquals(1, users.size()); List<Integer> foundIds = new ArrayList<Integer>(); for (User user : users) { foundIds.add(user.getId()); } assertTrue(foundIds.contains(3)); }
@Test public void testListUsersByEnabledStatus_nousers() { List<User> users = userDAO.listUsersByEnabledStatus(true); assertEquals(0, users.size()); }
@Test public void testGetByLoginNameIgnoreCase_notFound() { executeClassSql(); assertNull(userDAO.getByLoginNameIgnoreCase("usernotfound")); }
@Test public void testGetByLoginNameIgnoreCase_caseInsensitive() { executeClassSql(); assertEquals(4, userDAO.getByLoginNameIgnoreCase("User4").getId()); }
@Test public void testGetByLoginName_ignoreCase() { executeClassSql(); assertNull(userDAO.getByLoginName("User4")); }
@Test public void testGetByLoginName() { executeClassSql(); assertEquals(4, userDAO.getByLoginName("user4").getId()); }