LocalOcrScansTracker { public void setRemainingScans(int remainingScans) { Logger.info(this, "Setting scans remaining as {}.", remainingScans); sharedPreferences.get().edit().putInt(KEY_AVAILABLE_SCANS, remainingScans).apply(); remainingScansSubject.onNext(remainingScans); } @Inject  LocalOcrScansTracker(@NonNull Lazy<SharedPreferences> sharedPreferences); @VisibleForTesting  LocalOcrScansTracker(@NonNull Lazy<SharedPreferences> sharedPreferences,
                         @NonNull Scheduler firstLocalScanReadScheduler); @NonNull Observable<Integer> getRemainingScansStream(); int getRemainingScans(); void setRemainingScans(int remainingScans); void decrementRemainingScans();  }
@Test public void setRemainingScans() { TestObserver<Integer> testObserver = localOcrScansTracker.getRemainingScansStream().test(); localOcrScansTracker.setRemainingScans(50); assertEquals(50, localOcrScansTracker.getRemainingScans()); testObserver.assertValues(0, 50); testObserver.assertNotComplete(); testObserver.assertNoErrors(); }