diff --git a/tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java index cdd1e9e16a5..d0d8a25de9f 100644 --- a/tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java @@ -205,9 +205,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(String[].class); + ArgumentCaptor argumentCaptor = + ArgumentCaptor.forClass(CharSequence[].class); verify(pref, times(1)).setEntryValues(argumentCaptor.capture()); - assertFalse(Arrays.asList(argumentCaptor.getValue()) + assertFalse(toStringList(argumentCaptor.getValue()) .contains(VISIBILITY_NO_OVERRIDE)); } @@ -223,9 +224,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(String[].class); + ArgumentCaptor argumentCaptor = + ArgumentCaptor.forClass(CharSequence[].class); verify(pref, times(1)).setEntryValues(argumentCaptor.capture()); - assertFalse(Arrays.asList(argumentCaptor.getValue()) + assertFalse(toStringList(argumentCaptor.getValue()) .contains(VISIBILITY_NO_OVERRIDE)); } @@ -238,15 +240,24 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(String[].class); + ArgumentCaptor argumentCaptor = + ArgumentCaptor.forClass(CharSequence[].class); verify(pref, times(1)).setEntryValues(argumentCaptor.capture()); - List values = Arrays.asList(argumentCaptor.getValue()); + List values = toStringList(argumentCaptor.getValue()); assertEquals(3, values.size()); assertTrue(values.contains(String.valueOf(VISIBILITY_NO_OVERRIDE))); assertTrue(values.contains(String.valueOf(Notification.VISIBILITY_PRIVATE))); assertTrue(values.contains(String.valueOf(Notification.VISIBILITY_SECRET))); } + private static List toStringList(CharSequence[] charSequences) { + List result = new ArrayList<>(); + for (CharSequence charSequence : charSequences) { + result.add(charSequence.toString()); + } + return result; + } + @Test public void testUpdateState_noChannelOverride() throws Exception { Settings.Secure.putInt(mContext.getContentResolver(),