Skip to content

Commit

Permalink
Fixed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
uKL committed Jun 4, 2018
1 parent 3ae9ce3 commit 6b4dbea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ class BleDisconnectedExceptionTest extends Specification {

BleDisconnectedException objectUnderTest

def "toString should include message"() {
def "toString should include message with unknown status"() {

when:
objectUnderTest = new BleDisconnectedException("myBluetoothAddress")

then:
assert objectUnderTest.toString() ==
"com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from myBluetoothAddress"
"com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from myBluetoothAddress with status -1 (UNKNOWN)"
}

def "toString should include message with status"() {
given:
def expectedStatus = 0x81

when:
objectUnderTest = new BleDisconnectedException("myBluetoothAddress", expectedStatus)

then:
assert objectUnderTest.toString() ==
"com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from myBluetoothAddress with status $expectedStatus (GATT_INTERNAL_ERROR)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BleGattExceptionTest extends Specification {

then:
assert objectUnderTest.toString() ==
"com.polidea.rxandroidble2.exceptions.BleGattException: GATT exception from MAC address null, status 10, " +
"com.polidea.rxandroidble2.exceptions.BleGattException: GATT exception from MAC address null, status 10 (GATT_NOT_FOUND), " +
"type BleGattOperation{description='CONNECTION_STATE'}. " +
"(Look up status 0x0a here " +
"https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h)"
Expand Down

0 comments on commit 6b4dbea

Please sign in to comment.