コード例 #1
0
  @Test
  public void testChangeToTutorWhenTutor() {
    when(mockUser.getRole()).thenReturn(ConstantVariables.TUTOR);

    User tmpUser = userService.changeToTutor(this.mockUser);

    assertEquals(this.mockUser, tmpUser);
  }
コード例 #2
0
  @Test
  public void testChangeToTutorWhenStudent() {
    when(userDao.save(mockUser)).then(returnsFirstArg());
    when(mockUser.getRole()).thenReturn(ConstantVariables.STUDENT);

    userService.changeToTutor(this.mockUser);

    verify(mockUser).setRole(ConstantVariables.TUTOR);
  }