1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.settings.bluetooth; 17 18 import static com.android.settings.bluetooth.BluetoothDetailsMacAddressController.KEY_DEVICE_DETAILS_FOOTER; 19 20 import static com.google.common.truth.Truth.assertThat; 21 22 import com.android.settingslib.widget.FooterPreference; 23 24 import org.junit.Test; 25 import org.junit.runner.RunWith; 26 import org.robolectric.RobolectricTestRunner; 27 28 @RunWith(RobolectricTestRunner.class) 29 public class BluetoothDetailsMacAddressControllerTest extends BluetoothDetailsControllerTestBase { 30 private BluetoothDetailsMacAddressController mController; 31 32 @Override setUp()33 public void setUp() { 34 super.setUp(); 35 mController = 36 new BluetoothDetailsMacAddressController(mContext, mFragment, mCachedDevice, 37 mLifecycle); 38 setupDevice(mDeviceConfig); 39 mScreen.addPreference(new FooterPreference.Builder(mContext).setKey( 40 KEY_DEVICE_DETAILS_FOOTER).setTitle(KEY_DEVICE_DETAILS_FOOTER).build()); 41 } 42 43 @Test macAddress()44 public void macAddress() { 45 showScreen(mController); 46 FooterPreference footer = 47 (FooterPreference) mScreen.findPreference(mController.getPreferenceKey()); 48 assertThat(footer.getTitle().toString()).endsWith(mDeviceConfig.getAddress()); 49 } 50 } 51