@Test
public void scanForNamesFailedTest() throws Exception {

    application.grantPermissions(Manifest.permission.ACCESS_COARSE_LOCATION);
    String myName = "Polar";
    central.scanForPeripheralsWithNames(new String[]{myName});
    // Grab the scan callback that is used
    Field field = BluetoothCentral.class.getDeclaredField("scanByNameCallback");
    field.setAccessible(true);
    ScanCallback scanCallback = (ScanCallback) field.get(central);
    scanCallback.onScanFailed(SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES);
    verify(callback).onScanFailed(SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES);
}