Skip to content

Commit

Permalink
Migrated BleCannotSetCharacteristicNotificationExceptionTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszseweryn committed Mar 17, 2024
1 parent 73179f2 commit ba1baec
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.

This file was deleted.

@@ -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");
}
}

0 comments on commit ba1baec

Please sign in to comment.