Skip to content

Commit e35ae86

Browse files
Migrated BleCannotSetCharacteristicNotificationExceptionTest.
1 parent fa31ce4 commit e35ae86

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

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

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.polidea.rxandroidble2.exceptions;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import android.bluetooth.BluetoothGattCharacteristic;
6+
7+
import org.junit.jupiter.api.Test;
8+
import org.mockito.Mockito;
9+
10+
import java.util.UUID;
11+
12+
public class BleCannotSetCharacteristicNotificationExceptionTest {
13+
14+
@Test
15+
public void toStringShouldContainMessage() {
16+
// given
17+
BluetoothGattCharacteristic mockCharacteristic = Mockito.mock(BluetoothGattCharacteristic.class);
18+
Mockito.when(mockCharacteristic.getUuid()).thenReturn(new UUID(1, 2));
19+
BleCannotSetCharacteristicNotificationException out = new BleCannotSetCharacteristicNotificationException(
20+
mockCharacteristic,
21+
BleCannotSetCharacteristicNotificationException.CANNOT_SET_LOCAL_NOTIFICATION,
22+
new Exception("because"));
23+
24+
// expect
25+
assertEquals(out.toString(),
26+
"com.polidea.rxandroidble2.exceptions.BleCannotSetCharacteristicNotificationException: " +
27+
"Cannot set local notification (code 1) with characteristic UUID 00000000-0000-0001-0000-000000000002");
28+
}
29+
}

0 commit comments

Comments
 (0)