예제 #1
0
 @Test
 public void testGetAll() {
   List<User> users = userManager.all();
   Assert.assertTrue(users.size() > 0);
   for (User user : users) {
     Assert.assertTrue(user.getRoles().size() > 0);
   }
 }
예제 #2
0
 @Test
 public void testSave() {
   User user =
       UserBuilder.userBuilder(1)
           .username("test")
           .email("*****@*****.**")
           .password("test")
           .build();
   user = userManager.get(userManager.save(user, true));
   Assert.assertNotNull(user);
   Assert.assertNotNull(user.getUsername());
   Assert.assertEquals(new Integer(0), user.getUserLoginStatistic().getLoginOk());
   Assert.assertNotNull(user.getRoles());
   Assert.assertTrue(user.getRoles().size() > 0);
 }
예제 #3
0
 @Test
 public void testUpdate() {
   User user = userManager.get(1);
   Assert.assertNotNull(user);
   Assert.assertEquals(new Integer(0), user.getLoginOk());
   Assert.assertEquals(new Integer(0), user.getLoginKo());
   user.incrementLoginOk();
   userManager.update(user, true);
   sessionFactory.getCurrentSession().flush();
   user = userManager.get(1);
   Assert.assertEquals(new Integer(1), user.getLoginOk());
   Assert.assertEquals(new Integer(0), user.getLoginKo());
 }
예제 #4
0
 @Test
 public void testProperty() {
   User user = userManager.filter("username", "admin");
   Assert.assertNotNull(user);
   Assert.assertNotNull(user.getUsername());
 }
예제 #5
0
 @Test
 public void testGet() {
   User user = userManager.get(1);
   Assert.assertNotNull(user);
   Assert.assertNotNull(user.getUsername());
 }