Skip to content

Commit 73179f2

Browse files
Migrated BleDisconnectedExceptionTest.
1 parent 0fe048a commit 73179f2

File tree

2 files changed

+28
-33
lines changed

2 files changed

+28
-33
lines changed

rxandroidble/src/test/groovy/com/polidea/rxandroidble2/exceptions/BleDisconnectedExceptionTest.groovy

-33
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.polidea.rxandroidble2.exceptions;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
public class BleDisconnectedExceptionTest {
8+
9+
@SuppressWarnings("deprecation")
10+
@Test
11+
public void toStringShouldContainMessageWithUnknownStatus() {
12+
// given
13+
BleDisconnectedException out = new BleDisconnectedException("myBluetoothAddress");
14+
15+
// expect
16+
assertEquals(out.toString(), "com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status -1 (UNKNOWN)");
17+
}
18+
19+
@Test
20+
public void toStringShouldContainMessageWithStatus() {
21+
// given
22+
int expectedStatus = 129; // 0x81
23+
BleDisconnectedException out = new BleDisconnectedException("myBluetoothAddress", expectedStatus);
24+
25+
// expect
26+
assertEquals(out.toString(), "com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 129 (GATT_INTERNAL_ERROR)");
27+
}
28+
}

0 commit comments

Comments
 (0)