RxAndroidBle icon indicating copy to clipboard operation
RxAndroidBle copied to clipboard

Rework `mockrxandroidble`

Open dariuszseweryn opened this issue 6 years ago • 5 comments

Summary

In the current state the mockrxandroidble (mockclient) is not very usable both. It does not work well with unit tests and is not really usable for substitution in a live application due to lack of possibility to manage state.

The idea is either to deprecate the mockclient completely or to rework it so it could be used for instance with a server API

dariuszseweryn avatar Feb 12 '18 09:02 dariuszseweryn

I'd love to work on this. It is actually one of my work goals :) For our own library, we managed to create mocked remote BLE devices to be able to run end-to-end unit test and to monitor/test the BLE-requests received by remote BLE-devices. But it relies heavily on PowerMock and knowledge of the private internal implementation of the mockclient.

The code we have is in Kotlin only and not that pretty.

Which direction would you prefer?

  • Creating/updating the mockclient to make it work without the need for PowerMock (mockito only or through dependency injection) or
  • Remove the mockclient and modify the actual RxAndroidBle code to remove its dependency on classes such as BluetoothGattCharacteristic, etc., and replace those by interfaces whose implementations can be injected.

streetsofboston avatar Mar 12 '18 15:03 streetsofboston

Hey,

that's great!

We're planning future versions, we'll get back to you probably next week with some proposals.

uKL avatar Mar 16 '18 13:03 uKL

Sounds good! Thank you!

streetsofboston avatar Mar 16 '18 13:03 streetsofboston

When you say it doesn't work well with unit tests, do you mean the dependency on Robolectric or are there additional things to be aware of?

nateridderman avatar Jan 16 '19 20:01 nateridderman

Robolectric dependency is the issue for unit tests

dariuszseweryn avatar Jan 16 '19 21:01 dariuszseweryn