@Test public void requestPasswordResetInBackground_with_callback() throws Exception { NCMBUserService userService = getUserService(); userService.requestPasswordResetInBackground("sample@example.com", new DoneCallback() { @Override public void done(NCMBException e) { if (e != null) { Assert.fail("this should not be happen."); } callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(callbackFlag); }
public void requestPasswordResetInBackground(String mailAddress, DoneCallback callback) throws NCMBException { RequestParams reqParams = null; try { reqParams = requestPasswordResetParams(mailAddress); } catch (Exception e) { if (callback != null) { callback.done(new NCMBException(NCMBException.MISSING_VALUE, e.getMessage())); } return; } sendRequestAsync(reqParams, new UserServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(null); } } @Override public void handleError(NCMBException e) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(e); } } }); }
NCMBUserService extends NCMBService { public void requestPasswordResetInBackground(String mailAddress, DoneCallback callback) throws NCMBException { RequestParams reqParams = null; try { reqParams = requestPasswordResetParams(mailAddress); } catch (Exception e) { if (callback != null) { callback.done(new NCMBException(NCMBException.MISSING_VALUE, e.getMessage())); } return; } sendRequestAsync(reqParams, new UserServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(null); } } @Override public void handleError(NCMBException e) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(e); } } }); } }
NCMBUserService extends NCMBService { public void requestPasswordResetInBackground(String mailAddress, DoneCallback callback) throws NCMBException { RequestParams reqParams = null; try { reqParams = requestPasswordResetParams(mailAddress); } catch (Exception e) { if (callback != null) { callback.done(new NCMBException(NCMBException.MISSING_VALUE, e.getMessage())); } return; } sendRequestAsync(reqParams, new UserServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(null); } } @Override public void handleError(NCMBException e) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(e); } } }); } NCMBUserService(NCMBContext context); }
NCMBUserService extends NCMBService { public void requestPasswordResetInBackground(String mailAddress, DoneCallback callback) throws NCMBException { RequestParams reqParams = null; try { reqParams = requestPasswordResetParams(mailAddress); } catch (Exception e) { if (callback != null) { callback.done(new NCMBException(NCMBException.MISSING_VALUE, e.getMessage())); } return; } sendRequestAsync(reqParams, new UserServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(null); } } @Override public void handleError(NCMBException e) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(e); } } }); } NCMBUserService(NCMBContext context); NCMBUser registerByName(String userName, String password); NCMBUser registerByName(String userName, String password,JSONObject otherFields); void saveByName(String userName, String password); void saveByName(String userName, String password,JSONObject otherFields); void registerByNameInBackground(String userName, String password, LoginCallback callback); void registerByNameInBackground(String userName, String password, JSONObject otherFields, LoginCallback callback); NCMBUser registerByOauth(JSONObject oauthOptions); void registerByOauthInBackground(JSONObject oauthOptions, LoginCallback callback); void inviteByMail(String mailAddress); void inviteByMailInBackground(String mailAddress, DoneCallback callback); void requestPasswordReset(String mailAddress); void requestPasswordResetInBackground(String mailAddress, DoneCallback callback); NCMBUser fetchUser(String userId); void fetchUserInBackground(String userId, final FetchCallback callback); JSONObject updateUser(String userId, JSONObject params); void updateUserInBackground(final String userId, final JSONObject params, final ExecuteServiceCallback callback); NCMBUser loginByName(String userName, String password); void loginByNameInBackground(String userName, String password,
                                        LoginCallback callback); NCMBUser loginByMail(String mailAddress, String password); void loginByMailInBackground(String mailAddress, String password,
                                        LoginCallback callback); void deleteUser(String userId); void deleteUserInBackground(final String userId, ExecuteServiceCallback callback); void logout(); void logoutInBackground(DoneCallback callback); ArrayList<NCMBUser> searchUser(JSONObject conditions); void searchUserInBackground(JSONObject conditions, final SearchUserCallback callback); }
NCMBUserService extends NCMBService { public void requestPasswordResetInBackground(String mailAddress, DoneCallback callback) throws NCMBException { RequestParams reqParams = null; try { reqParams = requestPasswordResetParams(mailAddress); } catch (Exception e) { if (callback != null) { callback.done(new NCMBException(NCMBException.MISSING_VALUE, e.getMessage())); } return; } sendRequestAsync(reqParams, new UserServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(null); } } @Override public void handleError(NCMBException e) { DoneCallback callback = (DoneCallback) mCallback; if (callback != null) { callback.done(e); } } }); } NCMBUserService(NCMBContext context); NCMBUser registerByName(String userName, String password); NCMBUser registerByName(String userName, String password,JSONObject otherFields); void saveByName(String userName, String password); void saveByName(String userName, String password,JSONObject otherFields); void registerByNameInBackground(String userName, String password, LoginCallback callback); void registerByNameInBackground(String userName, String password, JSONObject otherFields, LoginCallback callback); NCMBUser registerByOauth(JSONObject oauthOptions); void registerByOauthInBackground(JSONObject oauthOptions, LoginCallback callback); void inviteByMail(String mailAddress); void inviteByMailInBackground(String mailAddress, DoneCallback callback); void requestPasswordReset(String mailAddress); void requestPasswordResetInBackground(String mailAddress, DoneCallback callback); NCMBUser fetchUser(String userId); void fetchUserInBackground(String userId, final FetchCallback callback); JSONObject updateUser(String userId, JSONObject params); void updateUserInBackground(final String userId, final JSONObject params, final ExecuteServiceCallback callback); NCMBUser loginByName(String userName, String password); void loginByNameInBackground(String userName, String password,
                                        LoginCallback callback); NCMBUser loginByMail(String mailAddress, String password); void loginByMailInBackground(String mailAddress, String password,
                                        LoginCallback callback); void deleteUser(String userId); void deleteUserInBackground(final String userId, ExecuteServiceCallback callback); void logout(); void logoutInBackground(DoneCallback callback); ArrayList<NCMBUser> searchUser(JSONObject conditions); void searchUserInBackground(JSONObject conditions, final SearchUserCallback callback); static final String SERVICE_PATH; static final int HTTP_STATUS_REGISTERED; static final int HTTP_STATUS_AUTHORIZED; static final int HTTP_STATUS_REQUEST_ACCEPTED; }