我正在学习在 Android 上通过低功耗蓝牙进行通信。这是一个示例应用程序
源代码中有几个与蓝牙相关的对象,它们显然是最终类:
private BluetoothManager mBluetoothManager;
private BluetoothAdapter mBluetoothAdapter;
private BluetoothGatt mBluetoothGatt;
当然,我不想测试 BluetoothManager、BluetoothAdapter 或 BluetoothGatt 本身之类的库内容。但我想测试BluetoothLeService : Service那个项目中写的。
我不知道,如何模拟这些final BluetoothManager, BluetoothAdapter or BluetoothGatt对象。
- 我该如何测试
BluetoothLeService? - 我可以写普通
test的 unit 还是需要androidTests在测试期间在设备连接的地方写特殊的 s? - 当我将集成系统作为构建环境时,这会是什么样子?