### Question:
UserEngineClient { public User create(UserCreator creator) { try { return identityAPI.createUser(creator); } catch (AlreadyExistsException e) { throw new APIForbiddenException(new _("Can't create user. User '%userName%' already exists", new Arg("userName", creator.getFields().get(UserField.NAME))), e); } catch (CreationException e) { throw new APIException(new _("Error when creating 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 create_create_a_user_in_engine_repository() throws Exception { UserCreator userCreator = new UserCreator("aName", "aPassword"); userEngineClient.create(userCreator); verify(identityAPI).createUser(userCreator); }
@Test(expected = APIException.class) public void create_throw_APIException_if_exception_occur_when_creating_user_in_engine_repository() throws Exception { UserCreator userCreator = new UserCreator("aName", "aPassword"); when(identityAPI.createUser(userCreator)).thenThrow(new CreationException("aMessage")); userEngineClient.create(userCreator); }