### Question:
ParseInstallation extends ParseObject { @Override void updateBeforeSave() { super.updateBeforeSave(); if (getCurrentInstallationController().isCurrent(ParseInstallation.this)) { updateTimezone(); updateVersionInfo(); updateDeviceInfo(); updateLocaleIdentifier(); } } ParseInstallation(); static ParseInstallation getCurrentInstallation(); static ParseQuery<ParseInstallation> getQuery(); String getInstallationId(); @Override void setObjectId(String newObjectId);  }### Answer:
@Test public void testUpdateBeforeSave() throws Exception { mocksForUpdateBeforeSave(); Locale.setDefault(new Locale("en", "US")); ParseInstallation installation = new ParseInstallation(); installation.updateBeforeSave(); String zone = installation.getString(KEY_TIME_ZONE); String deviceZone = TimeZone.getDefault().getID(); if (zone != null) { assertEquals(zone, deviceZone); } else { assertFalse(deviceZone.equals("GMT")); assertFalse(deviceZone.indexOf("/") > 0); } Context context = Parse.getApplicationContext(); String packageName = context.getPackageName(); PackageManager pm = context.getPackageManager(); PackageInfo pkgInfo = pm.getPackageInfo(packageName, 0); String appVersion = pkgInfo.versionName; String appName = pm.getApplicationLabel(pm.getApplicationInfo(packageName, 0)).toString(); assertEquals(packageName, installation.getString(KEY_APP_IDENTIFIER)); assertEquals(appName, installation.getString(KEY_APP_NAME)); assertEquals(appVersion, installation.getString(KEY_APP_VERSION)); assertEquals("android", installation.getString(KEY_DEVICE_TYPE)); assertEquals("installationId", installation.getString(KEY_INSTALLATION_ID)); assertEquals("en-US", installation.getString(KEY_LOCALE_IDENTIFIER)); }
@Test public void testLocaleIdentifierSpecialCases() throws Exception { mocksForUpdateBeforeSave(); ParseInstallation installation = new ParseInstallation(); Locale.setDefault(new Locale("iw", "US")); installation.updateBeforeSave(); assertEquals("he-US", installation.getString(KEY_LOCALE_IDENTIFIER)); Locale.setDefault(new Locale("in", "US")); installation.updateBeforeSave(); assertEquals("id-US", installation.getString(KEY_LOCALE_IDENTIFIER)); Locale.setDefault(new Locale("ji", "US")); installation.updateBeforeSave(); assertEquals("yi-US", installation.getString(KEY_LOCALE_IDENTIFIER)); Locale.setDefault(new Locale("en")); installation.updateBeforeSave(); assertEquals("en", installation.getString(KEY_LOCALE_IDENTIFIER)); }