Ejemplo n.º 1
0
 @Test
 public void testGetUserByNameOrMobileOrEmail() throws Exception {
   SysUser user = sysUserDao.getUserByNameOrMobileOrEmail("new_user_name");
   SysUser user2 = sysUserDao.getUserByNameOrMobileOrEmail("test_email");
   SysUser user3 = sysUserDao.getUserByNameOrMobileOrEmail("test_mobile");
   Assert.assertEquals(999999999l, user.getId().longValue());
   Assert.assertEquals(999999999l, user2.getId().longValue());
   Assert.assertEquals(999999999l, user3.getId().longValue());
 }
Ejemplo n.º 2
0
  @Test
  public void testCRUD() {
    SysUser user = new SysUser();
    setSimpleProperties(user);
    user.setUserName("test_userName");

    Assert.assertNull(user.getId());
    sysUserDao.saveOrUpdate(user);
    Long id = user.getId();
    Assert.assertNotNull(id);

    SysUser userTestSave = sysUserDao.load(id);
    Assert.assertEquals("test_userName", userTestSave.getUserName());

    userTestSave.setUserName("test_modify_name");
    sysUserDao.saveOrUpdate(userTestSave);

    SysUser userTestUpdate = sysUserDao.load(id);
    Assert.assertEquals("test_modify_name", userTestUpdate.getUserName());

    sysUserDao.remove(id);
    try {
      sysUserDao.load(id);
      Assert.fail("not here");
    } catch (Exception e) {
      Assert.assertTrue(true);
    }
  }
Ejemplo n.º 3
0
 @Test
 public void testGetUserByMobile() throws Exception {
   SysUser user = sysUserDao.getUserByMobile("test_mobile");
   Assert.assertEquals(999999999l, user.getId().longValue());
 }
Ejemplo n.º 4
0
 @Test
 public void testGetUserByUserName() throws Exception {
   SysUser user = sysUserDao.getUserByUserName("new_user_name");
   Assert.assertEquals(999999999l, user.getId().longValue());
 }