Merge "Fix build failed of Settings test cases while importing AndroidX"

This commit is contained in:
Fan Zhang
2018-12-17 18:14:01 +00:00
committed by Android (Google) Code Review
5 changed files with 15 additions and 10 deletions

View File

@@ -119,7 +119,8 @@ public class AvailableMediaDeviceGroupControllerTest {
mAvailableMediaDeviceGroupController.onDeviceAdded(mPreference);
assertThat(mPreferenceGroup.isVisible()).isTrue();
assertThat(mPreferenceGroup.findPreference(PREFERENCE_KEY_1)).isEqualTo(mPreference);
assertThat((Preference) mPreferenceGroup.findPreference(PREFERENCE_KEY_1))
.isEqualTo(mPreference);
}
@Test

View File

@@ -100,7 +100,8 @@ public class ConnectedDeviceGroupControllerTest {
mConnectedDeviceGroupController.onDeviceAdded(mPreference);
assertThat(mPreferenceGroup.isVisible()).isTrue();
assertThat(mPreferenceGroup.findPreference(PREFERENCE_KEY_1)).isEqualTo(mPreference);
assertThat((Preference) mPreferenceGroup.findPreference(PREFERENCE_KEY_1))
.isEqualTo(mPreference);
}
@Test

View File

@@ -29,6 +29,7 @@ import android.hardware.usb.UsbPort;
import android.os.Handler;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@@ -122,8 +123,8 @@ public class UsbDetailsPowerRoleControllerTest {
UsbPort.POWER_ROLE_SINK, UsbPort.DATA_ROLE_DEVICE);
assertThat(mPreference.isEnabled()).isFalse();
assertThat(mScreen.findPreference(mDetailsPowerRoleController.getPreferenceKey()))
.isEqualTo(mPreference);
assertThat((Preference) mScreen.findPreference(
mDetailsPowerRoleController.getPreferenceKey())).isEqualTo(mPreference);
}
@Test
@@ -134,7 +135,8 @@ public class UsbDetailsPowerRoleControllerTest {
mDetailsPowerRoleController.refresh(true, UsbManager.FUNCTION_NONE, UsbPort.POWER_ROLE_SINK,
UsbPort.DATA_ROLE_DEVICE);
assertThat(mScreen.findPreference(mDetailsPowerRoleController.getPreferenceKey())).isNull();
assertThat((Preference) mScreen.findPreference(
mDetailsPowerRoleController.getPreferenceKey())).isNull();
}
@Test

View File

@@ -105,7 +105,7 @@ public class BuildNumberPreferenceControllerTest {
public void displayPref_shouldAlwaysDisplay() {
mController.displayPreference(mScreen);
verify(mScreen.findPreference(mController.getPreferenceKey()))
verify((Preference) mScreen.findPreference(mController.getPreferenceKey()))
.setSummary(BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY));
verify(mScreen, never()).removePreference(any(Preference.class));
}

View File

@@ -218,7 +218,8 @@ public class WorkSoundPreferenceControllerTest {
mController.displayPreference(mScreen);
mController.onResume();
verify(mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE)).setVisible(false);
verify((Preference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
.setVisible(false);
}
@Test
@@ -242,11 +243,11 @@ public class WorkSoundPreferenceControllerTest {
verify(mWorkCategory, times(2)).setVisible(true);
// Sound preferences should explain that the profile isn't available yet.
verify(mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
verify((Preference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
.setSummary(eq(notAvailable));
verify(mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
verify((Preference) mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
.setSummary(eq(notAvailable));
verify(mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
verify((Preference) mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
.setSummary(eq(notAvailable));
}