Пример #1
0
  @Test(expected = AssertionError.class)
  public void testGetNullUserByPrincipal() {
    // GIVEN
    when(userDao.findByEmail(anyString())).thenReturn(null);

    // WHEN
    userService.getUserByPrincipal(this.mockAuthUser);
  }
Пример #2
0
  @Test
  public void testGetUserByPrincipal() {
    // GIVEN
    when(userDao.findByEmail(anyString())).thenReturn(this.mockUser);

    // WHEN
    User tmpUser = userService.getUserByPrincipal(this.mockAuthUser);

    // THEN
    assertEquals(tmpUser, this.mockUser);
  }