@Test public void testChangeToTutorWhenTutor() { when(mockUser.getRole()).thenReturn(ConstantVariables.TUTOR); User tmpUser = userService.changeToTutor(this.mockUser); assertEquals(this.mockUser, tmpUser); }
@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); }