### Question:
InAppMessageStreamManager { @VisibleForTesting static FetchEligibleCampaignsResponse cacheExpiringResponse() { return FetchEligibleCampaignsResponse.newBuilder().setExpirationEpochTimestampMillis(1).build(); } @Inject  InAppMessageStreamManager(
      @AppForeground ConnectableFlowable<String> appForegroundEventFlowable,
      @ProgrammaticTrigger ConnectableFlowable<String> programmaticTriggerEventFlowable,
      CampaignCacheClient campaignCacheClient,
      Clock clock,
      ApiClient apiClient,
      AnalyticsEventsManager analyticsEventsManager,
      Schedulers schedulers,
      ImpressionStorageClient impressionStorageClient,
      RateLimiterClient rateLimiterClient,
      @AppForeground RateLimit appForegroundRateLimit,
      TestDeviceHelper testDeviceHelper,
      FirebaseInstallationsApi firebaseInstallations,
      DataCollectionHelper dataCollectionHelper,
      AbtIntegrationHelper abtIntegrationHelper); static boolean isAppForegroundEvent(TriggeringCondition event); static boolean isAppForegroundEvent(String event); Flowable<TriggeredInAppMessage> createFirebaseInAppMessageStream(); static final String ON_FOREGROUND; }### Answer:
@Test public void stream_onAppOpen_dataCollectionDisabled_doesNotFetch() { when(dataCollectionHelper.isAutomaticDataCollectionEnabled()).thenReturn(false); appForegroundEmitter.onNext(ON_FOREGROUND_EVENT_NAME); subscriber.assertNoValues(); verify(mockApiClient, times(0)).getFiams(any(), any()); verify(campaignCacheClient, times(1)).put(InAppMessageStreamManager.cacheExpiringResponse()); }
@Test public void stream_onAppOpen_withEmptyIID_doesNotFetch() { when(firebaseInstallations.getId()).thenReturn(Tasks.forResult("")); appForegroundEmitter.onNext(ON_FOREGROUND_EVENT_NAME); verify(mockApiClient, times(0)).getFiams(any(), any()); verify(campaignCacheClient, times(1)).put(InAppMessageStreamManager.cacheExpiringResponse()); }
@Test public void stream_onAppOpen_withEmptyFIDToken_doesNotFetch() { when(firebaseInstallations.getToken(false)) .thenReturn( Tasks.forResult( new InstallationTokenResult() { @Override public String getToken() { return ""; } @Override public long getTokenExpirationTimestamp() { return 0; } @Override public long getTokenCreationTimestamp() { return 0; } @Override public Builder toBuilder() { return null; } })); appForegroundEmitter.onNext(ON_FOREGROUND_EVENT_NAME); verify(mockApiClient, times(0)).getFiams(any(), any()); verify(campaignCacheClient, times(1)).put(InAppMessageStreamManager.cacheExpiringResponse()); }