@@ -16,10 +16,12 @@ import com.nhaarman.mockitokotlin2.verify
16
16
import com.nhaarman.mockitokotlin2.verifyZeroInteractions
17
17
import com.nhaarman.mockitokotlin2.whenever
18
18
import com.twilio.audioswitch.android.BluetoothDeviceWrapper
19
+ import com.twilio.audioswitch.android.BluetoothDeviceWrapperImpl
19
20
import com.twilio.audioswitch.selection.AudioDeviceSelector.State.ACTIVATED
20
21
import com.twilio.audioswitch.selection.AudioDeviceSelector.State.STARTED
21
22
import com.twilio.audioswitch.selection.AudioDeviceSelector.State.STOPPED
22
23
import com.twilio.audioswitch.android.BuildWrapper
24
+ import com.twilio.audioswitch.android.DEFAULT_DEVICE_NAME
23
25
import com.twilio.audioswitch.android.LogWrapper
24
26
import com.twilio.audioswitch.bluetooth.BluetoothController
25
27
import com.twilio.audioswitch.bluetooth.BluetoothControllerAssertions
@@ -76,6 +78,18 @@ class AudioDeviceSelectorTest {
76
78
)
77
79
private val bluetoothControllerAssertions = BluetoothControllerAssertions ()
78
80
81
+ @Test
82
+ fun `availableAudioDevices should return a generic bluetooth device name if none was returned from the BluetoothDevice class` () {
83
+ audioDeviceSelector.start(audioDeviceChangeListener)
84
+ audioDeviceSelector.bluetoothDeviceConnectionListener.onBluetoothConnected(
85
+ BluetoothDeviceWrapperImpl (mock()))
86
+
87
+ val hasDefaultDeviceName = audioDeviceSelector.availableAudioDevices.any {
88
+ it.name == DEFAULT_DEVICE_NAME
89
+ }
90
+ assertThat(hasDefaultDeviceName, equalTo(true ))
91
+ }
92
+
79
93
@Test
80
94
fun `start should start the bluetooth and wired headset listeners` () {
81
95
audioDeviceSelector.start(audioDeviceChangeListener)
0 commit comments