BluetoothMacAddressResolutionHelper implements BluetoothDeviceDiscoverer.BluetoothDeviceDiscovererListener,
                   BluetoothGattManager.BluetoothGattManagerListener { public synchronized boolean stopBluetoothDeviceDiscovery() { boolean wasStopped = false; if (mBluetoothDeviceDiscoverer != null) { mBluetoothDeviceDiscoverer.stop(); mBluetoothDeviceDiscoverer = null; Log.d(TAG, "stopBluetoothDeviceDiscovery: Stopped"); wasStopped = true; } return wasStopped; } BluetoothMacAddressResolutionHelper(
            Context context, BluetoothAdapter bluetoothAdapter, DiscoveryManager discoveryManager,
            UUID bleServiceUuid, UUID provideBluetoothMacAddressRequestUuid);  BluetoothMacAddressResolutionHelper(
            Context context, BluetoothAdapter bluetoothAdapter, DiscoveryManager discoveryManager,
            UUID bleServiceUuid, UUID provideBluetoothMacAddressRequestUuid, SharedPreferences preferences); UUID getProvideBluetoothMacAddressRequestUuid(); String getCurrentProvideBluetoothMacAddressRequestId(); boolean getIsProvideBluetoothMacAddressModeStarted(); boolean getIsBluetoothMacAddressGattServerStarted(); boolean getIsReceiveBluetoothMacAddressModeStarted(); synchronized void stopAllBluetoothMacAddressResolutionOperations(); synchronized boolean startProvideBluetoothMacAddressMode(String requestId); synchronized void stopProvideBluetoothMacAddressMode(); void provideBluetoothMacAddressToDevice(BluetoothDevice bluetoothDevice); synchronized void startReceiveBluetoothMacAddressMode(String requestId); synchronized void stopReceiveBluetoothMacAddressMode(); void startBluetoothMacAddressGattServer(String requestId); synchronized boolean startBluetoothDeviceDiscovery(); synchronized boolean stopBluetoothDeviceDiscovery(); @Override void onBluetoothDeviceDiscovered(BluetoothDevice bluetoothDevice); @Override void onBluetoothGattClientOperationCountInQueueChanged(int operationCountInQueue); @Override void onProvideBluetoothMacAddressResult(String requestId, boolean wasCompleted); @Override void onBluetoothMacAddressResolved(String bluetoothMacAddress);  }
@Test public void testStopBluetoothDeviceDiscovery() throws Exception { assertThat("Returns false if bt discovery is null", mBluetoothMacAddressResolutionHelper.stopBluetoothDeviceDiscovery(), is(equalTo(false))); Field field = mBluetoothMacAddressResolutionHelper.getClass() .getDeclaredField("mBluetoothDeviceDiscoverer"); field.setAccessible(true); field.set(mBluetoothMacAddressResolutionHelper, mMockBluetoothDeviceDiscoverer); assertThat("Returns true if bt discovery properly stopped", mBluetoothMacAddressResolutionHelper.stopBluetoothDeviceDiscovery(), is(equalTo(true))); verify(mMockBluetoothDeviceDiscoverer, times(1)).stop(); assertThat("Is set to null if bt discovery properly stopped", field.get(mBluetoothMacAddressResolutionHelper), is(nullValue())); }