OcrInformationalTooltipInteractor { @SuppressLint("CheckResult") @SuppressWarnings("ResultOfMethodCallIgnored") public void initialize() { ocrPurchaseTracker.getRemainingScansStream() .subscribeOn(scheduler) .subscribe(remainingScans -> { if (remainingScans == SCANS_LEFT_TO_INFORM) { Logger.info(OcrInformationalTooltipInteractor.this, "{} scans remaining. Re-enabling our few scans remaining tracker.", remainingScans); stateTracker.setShouldShowOcrInfo(true); } if (lastRemainingScans == 1 && remainingScans == 0) { Logger.info(OcrInformationalTooltipInteractor.this, "No scans. Re-enabling our few scans remaining tracker."); stateTracker.setShouldShowOcrInfo(true); } lastRemainingScans = remainingScans; }); } @Inject  OcrInformationalTooltipInteractor(@NonNull Analytics analytics,
                                             @NonNull OcrInformationalTooltipStateTracker stateTracker,
                                             @NonNull OcrPurchaseTracker ocrPurchaseTracker,
                                             @NonNull IdentityManager identityManager,
                                             @NonNull ConfigurationManager configurationManager); @VisibleForTesting  OcrInformationalTooltipInteractor(@NonNull Analytics analytics,
                                      @NonNull OcrInformationalTooltipStateTracker stateTracker,
                                      @NonNull OcrPurchaseTracker ocrPurchaseTracker,
                                      @NonNull IdentityManager identityManager,
                                      @NonNull ConfigurationManager configurationManager,
                                      @NonNull Scheduler scheduler); @SuppressLint("CheckResult") @SuppressWarnings("ResultOfMethodCallIgnored") void initialize(); @NonNull Observable<OcrTooltipMessageType> getShowOcrTooltip(); void markTooltipInteraction();  }
@Test public void initializeWithNoScansRemaining() { when(ocrPurchaseTracker.getRemainingScansStream()).thenReturn(Observable.just(0)); interactor.initialize(); verifyZeroInteractions(stateTracker); }
@Test public void initializeWithManyScansRemaining() { when(ocrPurchaseTracker.getRemainingScansStream()).thenReturn(Observable.just(100)); interactor.initialize(); verifyZeroInteractions(stateTracker); }
@Test public void initializeWithMinimumScansRemainingToProvideHint() { when(ocrPurchaseTracker.getRemainingScansStream()).thenReturn(Observable.just(OcrInformationalTooltipInteractor.SCANS_LEFT_TO_INFORM)); interactor.initialize(); verify(stateTracker).setShouldShowOcrInfo(true); }
@Test public void initializeWithOneThenZeroScansRemaining() { when(ocrPurchaseTracker.getRemainingScansStream()).thenReturn(Observable.just(1, 0)); interactor.initialize(); verify(stateTracker).setShouldShowOcrInfo(true); }