RemoteConfigManager extends AirshipComponent { public void addRemoteAirshipConfigListener(@NonNull RemoteAirshipConfigListener listener) { listeners.add(listener); } RemoteConfigManager(@NonNull Context context, @NonNull PreferenceDataStore dataStore, @NonNull RemoteData remoteData); @VisibleForTesting  RemoteConfigManager(@NonNull Context context, @NonNull PreferenceDataStore dataStore, @NonNull RemoteData remoteData, @NonNull ModuleAdapter moduleAdapter); void addRemoteAirshipConfigListener(@NonNull RemoteAirshipConfigListener listener);  }
@Test public void testMissingAirshipConfig() { RemoteAirshipConfigListener listener = Mockito.mock(RemoteAirshipConfigListener.class); remoteConfigManager.addRemoteAirshipConfigListener(listener); JsonMap json = JsonMap.EMPTY_MAP; RemoteDataPayload remoteDataPayload = createRemoteDataPayload("app_config", 0, json); updates.onNext(Collections.singleton(remoteDataPayload)); ArgumentCaptor<RemoteAirshipConfig> argumentCaptor = ArgumentCaptor.forClass(RemoteAirshipConfig.class); verify(listener).onRemoteConfigUpdated(argumentCaptor.capture()); RemoteAirshipConfig config = argumentCaptor.getValue(); assertEquals(JsonMap.EMPTY_MAP.toJsonValue(), config.toJsonValue()); }
@Test public void testAirshipConfig() { RemoteAirshipConfigListener listener = Mockito.mock(RemoteAirshipConfigListener.class); remoteConfigManager.addRemoteAirshipConfigListener(listener); JsonMap json = JsonMap.newBuilder() .put("airship_config", JsonMap.newBuilder() .putOpt("device_api_url", "https: .putOpt("remote_data_url", "https: .putOpt("wallet_url", "https: .putOpt("analytics_url", "https: .build()) .build(); RemoteDataPayload remoteDataPayload = createRemoteDataPayload("app_config", 0, json); updates.onNext(Collections.singleton(remoteDataPayload)); ArgumentCaptor<RemoteAirshipConfig> argumentCaptor = ArgumentCaptor.forClass(RemoteAirshipConfig.class); verify(listener).onRemoteConfigUpdated(argumentCaptor.capture()); RemoteAirshipConfig config = argumentCaptor.getValue(); assertEquals(json.get("airship_config"), config.toJsonValue()); }