summaryrefslogtreecommitdiff
path: root/tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java')
-rw-r--r--tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java56
1 files changed, 0 insertions, 56 deletions
diff --git a/tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java b/tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java
deleted file mode 100644
index addb69f..0000000
--- a/tests/robotests/src/com/android/car/messenger/bluetooth/BluetoothMonitorTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.android.car.messenger.bluetooth;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.verify;
-
-import android.bluetooth.BluetoothMapClient;
-import android.bluetooth.BluetoothProfile;
-import android.content.Context;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class BluetoothMonitorTest {
-
- @Mock
- BluetoothMapClient mockMapClient;
- @Mock
- BluetoothMonitor.OnBluetoothEventListener mockBluetoothEventListener;
-
- private Context mContext;
- private BluetoothMonitor mBluetoothMonitor;
- private BluetoothProfile.ServiceListener mServiceListener;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mBluetoothMonitor = new BluetoothMonitor(mContext);
- mServiceListener = mBluetoothMonitor.getServiceListener();
- mBluetoothMonitor.registerListener(mockBluetoothEventListener);
- }
-
- @Test
- public void testServiceListener() {
- mServiceListener.onServiceConnected(BluetoothProfile.MAP_CLIENT, mockMapClient);
- verify(mockBluetoothEventListener).onMapConnected(mockMapClient);
-
- mServiceListener.onServiceDisconnected(BluetoothProfile.MAP_CLIENT);
- verify(mockBluetoothEventListener).onMapDisconnected();
- }
-
- @Test
- public void testRegisterListener() {
- assertThat(mBluetoothMonitor.registerListener(mockBluetoothEventListener)).isFalse();
- assertThat(mBluetoothMonitor.unregisterListener(mockBluetoothEventListener)).isTrue();
- assertThat(mBluetoothMonitor.registerListener(mockBluetoothEventListener)).isTrue();
- mBluetoothMonitor.onDestroy();
- assertThat(mBluetoothMonitor.registerListener(mockBluetoothEventListener)).isTrue();
- }
-}