NCMBInstallation extends NCMBObject { @Override public void fetch() throws NCMBException { NCMBInstallationService installationService = (NCMBInstallationService) NCMB.factory(NCMB.ServiceType.INSTALLATION); NCMBInstallation installation = installationService.fetchInstallation(getObjectId()); mFields = installation.mFields; } NCMBInstallation();   NCMBInstallation(JSONObject params); String getApplicationName(); String getAppVersion(); int getBadge(); JSONArray getChannels(); String getDeviceType(); String getDeviceToken(); void getDeviceTokenInBackground(final TokenCallback callback); String getSDKVersion(); String getTimeZone(); Object getValue(String name); void setApplicationName(String value); void setBadge(int value); void setChannels(JSONArray value); void setDeviceToken(String value); static NCMBInstallation getCurrentInstallation(); static NCMBQuery<NCMBInstallation> getQuery(); static void subscribe(String channel, Class<? extends Activity> activity); static void subscribe(String channelName, Class<? extends Activity> activity, int icon); static void unsubscribe(String channelName); static Set<String> getSubscriptions(); void save(); void saveInBackground(); void saveInBackground(final DoneCallback callback); @Override void fetch(); @Override void fetchInBackground(final FetchCallback callback); void delete(); void deleteInBackground(); void deleteInBackground(final DoneCallback callback);  }
@Test public void fetch() throws Exception { NCMBException error = null; NCMBInstallation installation = new NCMBInstallation(); installation.setObjectId("7FrmPTBKSNtVjajm"); try { installation.fetch(); } catch (NCMBException e) { error = e; } Assert.assertNull(error); Assert.assertEquals("7FrmPTBKSNtVjajm", installation.getObjectId()); Assert.assertEquals("xxxxxxxxxxxxxxxxxxx", installation.getLocalDeviceToken()); DateFormat format = NCMBDateFormat.getIso8601(); Assert.assertEquals(format.parse("2014-06-03T11:28:30.348Z"), installation.getCreateDate()); }
@Test public void fetch_error_none_objectId() throws Exception { NCMBException error = null; NCMBInstallation installation = new NCMBInstallation(); try { installation.fetch(); } catch (NCMBException e) { error = e; } Assert.assertNotNull(error); Assert.assertEquals("java.lang.IllegalArgumentException: objectId is must not be null.", error.getMessage()); }
@Test public void delete_error_none_objectId() throws Exception { NCMBException error = null; NCMBInstallation installation = new NCMBInstallation(); try { installation.fetch(); } catch (NCMBException e) { error = e; } Assert.assertNotNull(error); Assert.assertEquals("java.lang.IllegalArgumentException: objectId is must not be null.", error.getMessage()); }