UserHandler implements UserService.Iface { @Override public RequestStatus updateUser(User user) throws TException { assertNotNull(user); assertNotNull(user.getEmail()); return db.updateUser(user); } UserHandler(); @Override User getByEmail(String email); @Override List<User> searchUsers(String searchText); @Override List<User> getAllUsers(); @Override RequestStatus addUser(User user); @Override RequestStatus updateUser(User user); @Override RequestStatus deleteUser(User user, User adminUser); @Override String getDepartmentByEmail(String email);  }
@Test public void testUpdateUser() throws Exception { User userWithoutComment = new User().setEmail(DUMMY_EMAIL_ADDRESS_2); handler.addUser(userWithoutComment); userWithoutComment.setDepartment(DUMMY_DEPARTMENT); userWithoutComment.setCommentMadeDuringModerationRequest(DUMMY_COMMENT); handler.updateUser(userWithoutComment); User userFromDatabase = handler.getByEmail(DUMMY_EMAIL_ADDRESS_2); assertEquals(DUMMY_EMAIL_ADDRESS_2, userFromDatabase.getEmail()); assertEquals(DUMMY_DEPARTMENT, userFromDatabase.getDepartment()); assertFalse(userFromDatabase.isSetCommentMadeDuringModerationRequest()); }