Skip to content

Commit

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

This file was deleted.

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

0 comments on commit e35ae86

Please sign in to comment.