Blame view

src/test/java/fr/plil/sio/web/mvc/ViewUsersControllerTest.java 995 Bytes
aa193b2b   Julien Iguchi-Cartigny   First version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  package fr.plil.sio.web.mvc;
  
  import static org.junit.Assert.*;
  import org.junit.Before;
  import org.junit.Test;
  
  public class ViewUsersControllerTest {
  
      private ViewUsersController viewUsersController;
      private UserDao userDao;
      private UserSession userSession;
  
      @Before
      public void createInstances() {
          viewUsersController = new ViewUsersController();
          userDao = new UserDaoImpl();
          viewUsersController.setUserDao(userDao);
          userSession = new UserSession();
          userSession.setUsername("admin");
          viewUsersController.setUserSession(userSession);
      }
  
      @Test
      public void testPopulateUsers() {
          assertEquals(1, viewUsersController.populateUsers().size());
      }
  
      @Test
      public void testPopulateUser() {
          assertEquals("admin", viewUsersController.populateUser().getUsername());
      }
  
      @Test
      public void testGetViewUsers() {
          assertEquals("viewUsers",viewUsersController.getViewUsers());
      }
  }