@Test public void testMalformedScanResultDoesNotCrashBeaconHandler() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { final BeaconScanner scanner = new BeaconScanner .Builder(ApplicationProvider.getApplicationContext()) .setBleDevice(bleDevice) .setBeaconBatchListener(beaconListener) .setScanTasksExecutor(executorProvider) .build(); final ScanResult scanResult = new ScanResult( getBluetoothDevice("00:11:22:33:FF:EE"), null, -95, 0 ); scanner.start(); advanceTimeBy(10); bleDevice.transmitScanResult(scanResult); advanceTimeBy(10); assertEquals( emptySet(), beaconListener.nearbyBeacons ); }
@Override public void start() { scheduledExecutor.schedule( scanResumeJob, 0L, TimeUnit.MILLISECONDS ); scheduledExecutor.scheduleAtFixedRate( beaconsEvictionJob, scanDuration.scanDurationMillis, BEACON_EVICTION_PERIODICITY_MILLIS, TimeUnit.MILLISECONDS ); }
BeaconScanner implements IScanner { @Override public void start() { scheduledExecutor.schedule( scanResumeJob, 0L, TimeUnit.MILLISECONDS ); scheduledExecutor.scheduleAtFixedRate( beaconsEvictionJob, scanDuration.scanDurationMillis, BEACON_EVICTION_PERIODICITY_MILLIS, TimeUnit.MILLISECONDS ); } }
BeaconScanner implements IScanner { @Override public void start() { scheduledExecutor.schedule( scanResumeJob, 0L, TimeUnit.MILLISECONDS ); scheduledExecutor.scheduleAtFixedRate( beaconsEvictionJob, scanDuration.scanDurationMillis, BEACON_EVICTION_PERIODICITY_MILLIS, TimeUnit.MILLISECONDS ); } private  BeaconScanner(@NonNull IBleDevice bleDevice,
                          @NonNull ScanExecutorProvider scheduledExecutorProvider,
                          @NonNull IBeaconParser beaconParser,
                          @NonNull ITimeProvider timeProvider,
                          @NonNull ScanDuration scanDuration,
                          @Nullable Ranger ranger); }
BeaconScanner implements IScanner { @Override public void start() { scheduledExecutor.schedule( scanResumeJob, 0L, TimeUnit.MILLISECONDS ); scheduledExecutor.scheduleAtFixedRate( beaconsEvictionJob, scanDuration.scanDurationMillis, BEACON_EVICTION_PERIODICITY_MILLIS, TimeUnit.MILLISECONDS ); } private  BeaconScanner(@NonNull IBleDevice bleDevice,
                          @NonNull ScanExecutorProvider scheduledExecutorProvider,
                          @NonNull IBeaconParser beaconParser,
                          @NonNull ITimeProvider timeProvider,
                          @NonNull ScanDuration scanDuration,
                          @Nullable Ranger ranger); @Override void start(); @Override void stop(); @Nullable @Override Ranger getRanger(); }
BeaconScanner implements IScanner { @Override public void start() { scheduledExecutor.schedule( scanResumeJob, 0L, TimeUnit.MILLISECONDS ); scheduledExecutor.scheduleAtFixedRate( beaconsEvictionJob, scanDuration.scanDurationMillis, BEACON_EVICTION_PERIODICITY_MILLIS, TimeUnit.MILLISECONDS ); } private  BeaconScanner(@NonNull IBleDevice bleDevice,
                          @NonNull ScanExecutorProvider scheduledExecutorProvider,
                          @NonNull IBeaconParser beaconParser,
                          @NonNull ITimeProvider timeProvider,
                          @NonNull ScanDuration scanDuration,
                          @Nullable Ranger ranger); @Override void start(); @Override void stop(); @Nullable @Override Ranger getRanger();  }