NCMBRole extends NCMBBase { public void removeUserInBackground(List<NCMBUser> users, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeUserRelationsInBackground(getObjectId(), users, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(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);  }
@Test public void removeUserInBackground() throws Exception { NCMBUser user1 = new NCMBUser(); user1.setObjectId("dummyUserObjectId1"); NCMBUser user2 = new NCMBUser(); user2.setObjectId("dummyUserObjectId2"); NCMBRole role = new NCMBRole("testRole"); role.setObjectId("dummyRoleId"); role.removeUserInBackground(Arrays.asList(user1, user2), new DoneCallback() { @Override public void done(NCMBException e) { if (e != null) { Assert.fail(e.getMessage()); } callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); SimpleDateFormat df = NCMBDateFormat.getIso8601(); Assert.assertEquals(df.parse("2014-06-04T11:28:30.348Z"), role.getUpdateDate()); Assert.assertNull(role.getString("belongUser")); Assert.assertTrue(callbackFlag); }