@Test public void fetchObjectInBackground() throws Exception { NCMBRole role = new NCMBRole("testRole"); role.setObjectId("dummyRoleId"); role.fetchObjectInBackground(new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole fetchedRole, NCMBException e) { if (e != null) { Assert.fail(e.getMessage()); } callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertEquals("role_test1", role.getRoleName()); SimpleDateFormat df = NCMBDateFormat.getIso8601(); Assert.assertEquals(df.parse("2013-08-30T05:04:19.045Z"), role.getCreateDate()); Assert.assertEquals(df.parse("2013-08-30T05:04:19.045Z"), role.getCreateDate()); Assert.assertTrue(callbackFlag); }
public void fetchObjectInBackground(final FetchCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.fetchRoleInBackground(getObjectId(), new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole role, NCMBException e) { NCMBException error = null; if (e != null) { error = e; } else { mFields = role.mFields; } if (callback != null) { callback.done(role, null); } } }); } catch (NCMBException e) { if (callback != null) { callback.done(null, e); } } }
NCMBRole extends NCMBBase { public void fetchObjectInBackground(final FetchCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.fetchRoleInBackground(getObjectId(), new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole role, NCMBException e) { NCMBException error = null; if (e != null) { error = e; } else { mFields = role.mFields; } if (callback != null) { callback.done(role, null); } } }); } catch (NCMBException e) { if (callback != null) { callback.done(null, e); } } } }
NCMBRole extends NCMBBase { public void fetchObjectInBackground(final FetchCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.fetchRoleInBackground(getObjectId(), new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole role, NCMBException e) { NCMBException error = null; if (e != null) { error = e; } else { mFields = role.mFields; } if (callback != null) { callback.done(role, null); } } }); } catch (NCMBException e) { if (callback != null) { callback.done(null, e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); }
NCMBRole extends NCMBBase { public void fetchObjectInBackground(final FetchCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.fetchRoleInBackground(getObjectId(), new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole role, NCMBException e) { NCMBException error = null; if (e != null) { error = e; } else { mFields = role.mFields; } if (callback != null) { callback.done(role, null); } } }); } catch (NCMBException e) { if (callback != null) { callback.done(null, e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); static NCMBQuery<NCMBRole> getQuery(); String getRoleName(); void setRoleName(String name); void addUser(List<NCMBUser> users); void addUserInBackground(List<NCMBUser> users, final DoneCallback callback); void removeUser(List<NCMBUser> users); void removeUserInBackground(List<NCMBUser> users, final DoneCallback callback); void addRole(List<NCMBRole> roles); void addRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void removeRole(List<NCMBRole> roles); void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void createRole(); void createRoleInBackground(final DoneCallback callback); void fetchObject(); void fetchObjectInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); }
NCMBRole extends NCMBBase { public void fetchObjectInBackground(final FetchCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.fetchRoleInBackground(getObjectId(), new FetchCallback<NCMBRole>() { @Override public void done(NCMBRole role, NCMBException e) { NCMBException error = null; if (e != null) { error = e; } else { mFields = role.mFields; } if (callback != null) { callback.done(role, null); } } }); } catch (NCMBException e) { if (callback != null) { callback.done(null, e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); static NCMBQuery<NCMBRole> getQuery(); String getRoleName(); void setRoleName(String name); void addUser(List<NCMBUser> users); void addUserInBackground(List<NCMBUser> users, final DoneCallback callback); void removeUser(List<NCMBUser> users); void removeUserInBackground(List<NCMBUser> users, final DoneCallback callback); void addRole(List<NCMBRole> roles); void addRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void removeRole(List<NCMBRole> roles); void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void createRole(); void createRoleInBackground(final DoneCallback callback); void fetchObject(); void fetchObjectInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback);  }