コード例 #1
0
  @Test
  public void shouldReturnUserOnEdit() {
    User user = controller.edit(1L);

    assertThat(user, notNullValue());
    assertThat(user.getId(), equalTo(1L));
  }
コード例 #2
0
  @Test
  public void shouldReturnPage() {
    Page<User> paginate = controller.index();

    List<User> list = paginate.getList();
    User user = list.get(0);

    assertThat(paginate, instanceOf(Page.class));
    assertThat(paginate.getPageSize(), equalTo(1));
    assertThat(user.getId(), equalTo(1L));
    assertThat(user.getEmail(), equalTo("Foo"));
  }
コード例 #3
0
  @Before
  public void setUp() throws Exception {
    user = new User();
    user.setId(1l);
    user.setEmail("Foo");

    role = new Role();
    role.setId(1L);
    role.setName("Bar");
    role.setAccessLevel(1);

    result = spy(new MockSerializationResult());
    act = spy(new MockAct(result).returning(user, role));
    controller = new UserController(act);
  }