-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated BleCannotSetCharacteristicNotificationExceptionTest.
- Loading branch information
1 parent
73179f2
commit ba1baec
Showing
2 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
...lidea/rxandroidble2/exceptions/BleCannotSetCharacteristicNotificationExceptionTest.groovy
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...polidea/rxandroidble2/exceptions/BleCannotSetCharacteristicNotificationExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.polidea.rxandroidble2.exceptions; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import android.bluetooth.BluetoothGattCharacteristic; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import java.util.UUID; | ||
|
||
public class BleCannotSetCharacteristicNotificationExceptionTest { | ||
|
||
@Test | ||
public void toStringShouldContainMessage() { | ||
// given | ||
BluetoothGattCharacteristic mockCharacteristic = Mockito.mock(BluetoothGattCharacteristic.class); | ||
Mockito.when(mockCharacteristic.getUuid()).thenReturn(new UUID(1, 2)); | ||
BleCannotSetCharacteristicNotificationException out = new BleCannotSetCharacteristicNotificationException( | ||
mockCharacteristic, | ||
BleCannotSetCharacteristicNotificationException.CANNOT_SET_LOCAL_NOTIFICATION, | ||
new Exception("because")); | ||
|
||
// expect | ||
assertEquals(out.toString(), | ||
"com.polidea.rxandroidble2.exceptions.BleCannotSetCharacteristicNotificationException: " + | ||
"Cannot set local notification (code 1) with characteristic UUID 00000000-0000-0001-0000-000000000002"); | ||
} | ||
} |