use of com.facebook.internal.FetchedAppSettings in project facebook-android-sdk by facebook.
the class AutomaticAnalyticsTest method testAutomaticLoggingEnabledServerConfiguration.
@Test
public void testAutomaticLoggingEnabledServerConfiguration() throws Exception {
JSONObject settingsJSON = new JSONObject();
settingsJSON.put("app_events_feature_bitmask", "0");
FetchedAppSettings settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
assertEquals(settings.getAutomaticLoggingEnabled(), false);
settingsJSON.put("app_events_feature_bitmask", "7");
settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
assertEquals(settings.getAutomaticLoggingEnabled(), false);
settingsJSON.put("app_events_feature_bitmask", "23");
settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
assertEquals(settings.getAutomaticLoggingEnabled(), false);
settingsJSON.put("app_events_feature_bitmask", "8");
settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
assertEquals(settings.getAutomaticLoggingEnabled(), true);
settingsJSON.put("app_events_feature_bitmask", "9");
settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
assertEquals(settings.getAutomaticLoggingEnabled(), true);
JSONObject noBitmaskFieldSettings = new JSONObject();
settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", noBitmaskFieldSettings);
assertEquals(settings.getAutomaticLoggingEnabled(), false);
}
Aggregations