@Test public void testOnScanResult() throws Exception { mBleScanner.onScanResult(1, null); verify(mMockListener, never()).onScanResult(any(ScanResult.class)); mBleScanner.onScanResult(1, mMockScanResult1); verify(mMockListener, times(1)).onScanResult(mMockScanResult1); }
@Override public void onScanResult(int callbackType, ScanResult scanResult) { super.onScanResult(callbackType, scanResult); Log.d(TAG, "onScanResult: " + ThreadUtils.currentThreadToString()); if (scanResult != null) { Log.d(TAG, "onScanResult: " + scanResult.toString() + ". " + ThreadUtils.currentThreadToString()); if (mListener == null) { Log.e(TAG, "No listener"); } if (mListener != null) { mListener.onScanResult(scanResult); } } else { Log.d(TAG, "onScanResult: there are no scan result"); } }
BleScanner extends ScanCallback { @Override public void onScanResult(int callbackType, ScanResult scanResult) { super.onScanResult(callbackType, scanResult); Log.d(TAG, "onScanResult: " + ThreadUtils.currentThreadToString()); if (scanResult != null) { Log.d(TAG, "onScanResult: " + scanResult.toString() + ". " + ThreadUtils.currentThreadToString()); if (mListener == null) { Log.e(TAG, "No listener"); } if (mListener != null) { mListener.onScanResult(scanResult); } } else { Log.d(TAG, "onScanResult: there are no scan result"); } } }
BleScanner extends ScanCallback { @Override public void onScanResult(int callbackType, ScanResult scanResult) { super.onScanResult(callbackType, scanResult); Log.d(TAG, "onScanResult: " + ThreadUtils.currentThreadToString()); if (scanResult != null) { Log.d(TAG, "onScanResult: " + scanResult.toString() + ". " + ThreadUtils.currentThreadToString()); if (mListener == null) { Log.e(TAG, "No listener"); } if (mListener != null) { mListener.onScanResult(scanResult); } } else { Log.d(TAG, "onScanResult: there are no scan result"); } } BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter);  BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter,
                      ScanSettings.Builder builder, DiscoveryManagerSettings settings); }
BleScanner extends ScanCallback { @Override public void onScanResult(int callbackType, ScanResult scanResult) { super.onScanResult(callbackType, scanResult); Log.d(TAG, "onScanResult: " + ThreadUtils.currentThreadToString()); if (scanResult != null) { Log.d(TAG, "onScanResult: " + scanResult.toString() + ". " + ThreadUtils.currentThreadToString()); if (mListener == null) { Log.e(TAG, "No listener"); } if (mListener != null) { mListener.onScanResult(scanResult); } } else { Log.d(TAG, "onScanResult: there are no scan result"); } } BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter);  BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter,
                      ScanSettings.Builder builder, DiscoveryManagerSettings settings); boolean isStarted(); synchronized boolean start(); synchronized void stop(boolean notifyStateChanged); void clearScanFilters(); void addScanFilter(ScanFilter scanFilter); void setScanSettings(ScanSettings scanSettings); @TargetApi(23) void applyAdditionalMarshmallowSettings(ScanSettings.Builder scanSettingsBuilder); @Override void onBatchScanResults(List<ScanResult> scanResults); @Override void onScanFailed(int errorCode); @Override void onScanResult(int callbackType, ScanResult scanResult); }
BleScanner extends ScanCallback { @Override public void onScanResult(int callbackType, ScanResult scanResult) { super.onScanResult(callbackType, scanResult); Log.d(TAG, "onScanResult: " + ThreadUtils.currentThreadToString()); if (scanResult != null) { Log.d(TAG, "onScanResult: " + scanResult.toString() + ". " + ThreadUtils.currentThreadToString()); if (mListener == null) { Log.e(TAG, "No listener"); } if (mListener != null) { mListener.onScanResult(scanResult); } } else { Log.d(TAG, "onScanResult: there are no scan result"); } } BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter);  BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter,
                      ScanSettings.Builder builder, DiscoveryManagerSettings settings); boolean isStarted(); synchronized boolean start(); synchronized void stop(boolean notifyStateChanged); void clearScanFilters(); void addScanFilter(ScanFilter scanFilter); void setScanSettings(ScanSettings scanSettings); @TargetApi(23) void applyAdditionalMarshmallowSettings(ScanSettings.Builder scanSettingsBuilder); @Override void onBatchScanResults(List<ScanResult> scanResults); @Override void onScanFailed(int errorCode); @Override void onScanResult(int callbackType, ScanResult scanResult);  }