Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dariuszseweryn/RxAndroidBle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e2cff211c2978e83b32bcc7ed04f86af36c007b2
Choose a base ref
..
head repository: dariuszseweryn/RxAndroidBle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f0211284ffa2f5f7eb818b4e325af82cfc73de0e
Choose a head ref
Showing with 20 additions and 0 deletions.
  1. +20 −0 rxandroidble/src/test/groovy/com/polidea/rxandroidble2/internal/RxBleDeviceTest.groovy
Original file line number Diff line number Diff line change
@@ -316,6 +316,26 @@ class RxBleDeviceTest extends Specification {
rxBleDevice.getBluetoothDevice() == mockBluetoothDevice
}
@Unroll
def "should call BluetoothDevice.getName() when called toString() only when BLUETOOTH_CONNECT permission is granted"() {
given:
def localMockCheckerConnectPermission = Mock(CheckerConnectPermission)
localMockCheckerConnectPermission.isConnectRuntimePermissionGranted() >> permissionGranted
def localDevice = new RxBleDeviceImpl(mockBluetoothDevice, null, BehaviorRelay.create(), localMockCheckerConnectPermission)
when:
localDevice.toString()
then:
expectedCallsToGetName * mockBluetoothDevice.getName()
where:
permissionGranted | expectedCallsToGetName
true | 1
false | 0
}
void startConnecting() {
rxStartConnecting().subscribe({}, {})
}