1 package org.robolectric.shadows; 2 3 import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2; 4 import static com.google.common.truth.Truth.assertThat; 5 6 import android.bluetooth.BluetoothAdapter; 7 import android.bluetooth.BluetoothManager; 8 import android.content.Context; 9 import androidx.test.core.app.ApplicationProvider; 10 import androidx.test.ext.junit.runners.AndroidJUnit4; 11 import org.junit.Test; 12 import org.junit.runner.RunWith; 13 import org.robolectric.annotation.Config; 14 15 @RunWith(AndroidJUnit4.class) 16 @Config(minSdk = JELLY_BEAN_MR2) 17 public class ShadowBluetoothManagerTest { 18 private final BluetoothManager manager = 19 (BluetoothManager) 20 ApplicationProvider.getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE); 21 22 @Test getAdapter_shouldReturnBluetoothAdapter()23 public void getAdapter_shouldReturnBluetoothAdapter() { 24 assertThat(manager.getAdapter()).isSameInstanceAs(BluetoothAdapter.getDefaultAdapter()); 25 } 26 } 27