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 a2e1368
Showing 1 changed file with 14 additions and 2 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)"
}
}

0 comments on commit a2e1368

Please sign in to comment.