### Question:
UserEngineClient { public User update(long userId, UserUpdater userUpdater) { try { return identityAPI.updateUser(userId, userUpdater); } catch (UserNotFoundException e) { throw new APIException(new _("Can't update user. User not found"), e); } catch (UpdateException e) { throw new APIException(new _("Error when updating user"), e); } } UserEngineClient(IdentityAPI identityAPI); User update(long userId, UserUpdater userUpdater); User create(UserCreator creator); User get(long userId); void delete(List<Long> userIds); SearchResult<User> search(SearchOptions searchOptions); List<User> getUsersInGroup(long groupId, int startIndex, int maxResults);  }### Answer:
@Test public void update_update_a_user_in_engine_repository() throws Exception { UserUpdater userUpdater = new UserUpdater(); userEngineClient.update(1L, userUpdater); verify(identityAPI).updateUser(1L, userUpdater); }
@Test(expected = APIException.class) public void update_throw_APIException_if_user_is_not_found_in_engine_repository() throws Exception { UserUpdater userUpdater = new UserUpdater(); when(identityAPI.updateUser(1L, userUpdater)).thenThrow(new UserNotFoundException("aMessage")); userEngineClient.update(1L, userUpdater); }
@Test(expected = APIException.class) public void update_throw_APIException_if_exception_occur_when_updating_user_in_engine_repository() throws Exception { UserUpdater userUpdater = new UserUpdater(); when(identityAPI.updateUser(1L, userUpdater)).thenThrow(new UpdateException("aMessage")); userEngineClient.update(1L, userUpdater); }