@Test
public void scanForPeripheralsUsingFiltersTest() throws Exception {

    application.grantPermissions(Manifest.permission.ACCESS_COARSE_LOCATION);
    String myAddress = "12:23:34:98:76:54";
    List<ScanFilter> myfilters = new ArrayList<>();
    ScanFilter filter = new ScanFilter.Builder()
            .setDeviceAddress(myAddress)
            .build();
    myfilters.add(filter);
    central.scanForPeripheralsUsingFilters(myfilters);
    // Make sure startScan is called
    ArgumentCaptor<List> scanFiltersCaptor = ArgumentCaptor.forClass(List.class);
    ArgumentCaptor<ScanSettings> scanSettingsCaptor = ArgumentCaptor.forClass(ScanSettings.class);
    ArgumentCaptor<ScanCallback> scanCallbackCaptor = ArgumentCaptor.forClass(ScanCallback.class);
    verify(scanner).startScan(scanFiltersCaptor.capture(), scanSettingsCaptor.capture(), scanCallbackCaptor.capture());
    // Verify there is only 1 filter set
    List<ScanFilter> filters = scanFiltersCaptor.getValue();
    assertEquals(1, filters.size());
    // Verify the filter only contains the valid address we added
    ScanFilter addressFilter = filters.get(0);
    String address = addressFilter.getDeviceAddress();
    assertEquals(myAddress, address);
}