I am learning to communicate over Bluetooth Low Energy on Android.. Here is an example app
There in there source code are several Bluetooth related objects, which were final classes obviously:
private BluetoothManager mBluetoothManager;
private BluetoothAdapter mBluetoothAdapter;
private BluetoothGatt mBluetoothGatt;
Of course I do not want to test library stuff like BluetoothManager, BluetoothAdapter or BluetoothGatt itself. But I want to test BluetoothLeService : Service
which was written in that project.
I do not know, how to mock these final BluetoothManager, BluetoothAdapter or BluetoothGatt
objects.
- How can I test
BluetoothLeService
? - Can I write plain unit
test
s or do I need to write specialandroidTests
s where the device is connected during the tests? - How would this look when I have integration systems as a build environment?
rivate BluetoothLeService mBluetoothLeService;
then call your functions. I do this via a device control activity