@Test
public void testEnableConnectedNotifications() throws Exception {
Notification<Boolean> notification = mock(Notification.class);
ArgumentCaptor<BluetoothNotification> captor = ArgumentCaptor.forClass(BluetoothNotification.class);
doNothing().when(bluetoothDevice).enableConnectedNotifications(captor.capture());
tinyBDevice.enableConnectedNotifications(notification);
verify(bluetoothDevice, times(1)).enableConnectedNotifications(captor.getValue());
verifyNoMoreInteractions(bluetoothDevice, notification);
captor.getValue().run(CONNECTED);
verify(notification, times(1)).notify(CONNECTED);
doThrow(RuntimeException.class).when(notification).notify(anyBoolean());
captor.getValue().run(false);
verify(notification, times(1)).notify(false);
}
TinyBDeviceTest.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:bluetooth-manager-tinyb
作者:
评论列表
文章目录