@Test public void fetch_object_in_background() throws Exception { Assert.assertFalse(callbackFlag); NCMBObject obj = new NCMBObject("TestClass"); obj.setObjectId("getTestObjectId"); obj.fetchInBackground(new FetchCallback<NCMBObject>() { @Override public void done(NCMBObject object, NCMBException e) { object.getString("key"); if (e != null) { Assert.fail("get object raise exception:" + e.getMessage()); } else { Assert.assertEquals("7FrmPTBKSNtVjajm", object.getObjectId()); Assert.assertEquals("value", object.getString("key")); SimpleDateFormat df = NCMBDateFormat.getIso8601(); try { Assert.assertTrue(object.getCreateDate().equals(df.parse("2014-06-03T11:28:30.348Z"))); Assert.assertTrue(object.getUpdateDate().equals(df.parse("2014-06-03T11:28:30.348Z"))); } catch (ParseException | NCMBException error) { Assert.fail(error.getMessage()); } } callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(callbackFlag); Assert.assertEquals("7FrmPTBKSNtVjajm", obj.getObjectId()); Assert.assertEquals("value", obj.getString("key")); SimpleDateFormat df = NCMBDateFormat.getIso8601(); Assert.assertTrue(obj.getCreateDate().equals(df.parse("2014-06-03T11:28:30.348Z"))); Assert.assertTrue(obj.getUpdateDate().equals(df.parse("2014-06-03T11:28:30.348Z"))); JSONAssert.assertEquals("{}", obj.getAcl().toJson().toString(), false); }
public void fetchInBackground() { fetchInBackground(null); }
NCMBObject extends NCMBBase { public void fetchInBackground() { fetchInBackground(null); } }
NCMBObject extends NCMBBase { public void fetchInBackground() { fetchInBackground(null); } NCMBObject(String className);   NCMBObject(String className, JSONObject params); }
NCMBObject extends NCMBBase { public void fetchInBackground() { fetchInBackground(null); } NCMBObject(String className);   NCMBObject(String className, JSONObject params); void save(); void saveInBackground(final DoneCallback callback); void fetch(); void fetchInBackground(); void fetchInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); void increment(String key, int amount); void addToList(String key, List objects); void addUniqueToList(String key, List objects); void removeFromList(String key, List objects); }
NCMBObject extends NCMBBase { public void fetchInBackground() { fetchInBackground(null); } NCMBObject(String className);   NCMBObject(String className, JSONObject params); void save(); void saveInBackground(final DoneCallback callback); void fetch(); void fetchInBackground(); void fetchInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); void increment(String key, int amount); void addToList(String key, List objects); void addUniqueToList(String key, List objects); void removeFromList(String key, List objects);  }