### Question:
ThrottledLollipopScanner implements Scanner { @Override public Observable<ScanData> scan() { return scan(DEFAULT_SCAN_MODE); } ThrottledLollipopScanner();  ThrottledLollipopScanner(ParsedAdvertisement.Factory parsedAdDataFactory,
                                  long maxScanDurationMs,
                                  long pauseIntervalMs); @Override Observable<ScanData> scan(); @Override Observable<ScanData> scan(final int scanMode); static final long ANDROID_7_MAX_SCAN_DURATION_MS; static final long PAUSE_INTERVAL_MS; static final long SCAN_WINDOW_MS; }### Answer:
@Test public void scan_failed_bluetoothUnsupported() { when(BluetoothAdapter.getDefaultAdapter()).thenReturn(null); scanDataTestObserver = scanner.scan().test(); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); scanDataTestObserver.assertError( throwable -> { ConnectionError error = (ConnectionError) throwable; return error != null && error.getCode() == ConnectionError.Code.SCAN_FAILED; }); }
@Test public void scan_failed_bluetoothOff() { when(bluetoothAdapter.isEnabled()).thenReturn(false); when(BluetoothAdapter.getDefaultAdapter()).thenReturn(bluetoothAdapter); scanDataTestObserver = scanner.scan().test(); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); scanDataTestObserver.assertError( throwable -> { ConnectionError error = (ConnectionError) throwable; return error != null && error.getCode() == ConnectionError.Code.SCAN_FAILED; }); }
@Test public void scan_shared_inProgress() { when(bluetoothAdapter.isEnabled()).thenReturn(true); when(BluetoothAdapter.getDefaultAdapter()).thenReturn(bluetoothAdapter); scanner.scan().test(); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); scanDataTestObserver = scanner.scan().test(); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); scanDataTestObserver.assertNoErrors(); scanDataTestObserver.hasSubscription(); }