### Question:
APIUser extends ConsoleAPI<UserItem> implements APIHasAdd<UserItem>, APIHasDelete, APIHasUpdate<UserItem>,
        APIHasGet<UserItem>, APIHasSearch<UserItem> { @Override public UserItem add(final UserItem item) { if (StringUtil.isBlank(item.getPassword())) { throw new ValidationException(Collections.singletonList(new ValidationError("Password", "%attribute% is mandatory"))); } checkPasswordRobustness(item.getPassword()); return getUserDatastore().add(item); }  @Override String defineDefaultSearchOrder(); @Override UserItem add(final UserItem item); @Override UserItem update(final APIID id, final Map<String, String> item); @Override UserItem get(final APIID id); @Override ItemSearchResult<UserItem> search(final int page, final int resultsByPage, final String search, final String orders,
            final Map<String, String> filters); @Override void delete(final List<APIID> ids);  }### Answer:
@Test public void should_check_password_robustness_on_add() throws Exception { UserItem userItem = new UserItem(); userItem.setUserName("John"); userItem.setPassword("this password is not accepted by the TestValidator validator"); expectedException.expect(ValidationException.class); expectedException.expectMessage("the validator TestValidator rejected this password"); apiUser.add(userItem); }
@Test public void should_throw_exception_when_adding_a_user_with_no_password() throws Exception { UserItem userItem = new UserItem(); userItem.setUserName("John"); expectedException.expect(ValidationException.class); apiUser.add(userItem); }
@Test public void should_add_user_if_password_is_valid() throws Exception { UserItem userItem = new UserItem(); userItem.setUserName("John"); userItem.setPassword("accepted password"); apiUser.add(userItem); }