Loading tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java +17 −6 Original line number Diff line number Diff line Loading @@ -205,9 +205,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> 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)); } Loading @@ -223,9 +224,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> 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)); } Loading @@ -238,15 +240,24 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> argumentCaptor = ArgumentCaptor.forClass(CharSequence[].class); verify(pref, times(1)).setEntryValues(argumentCaptor.capture()); List<String> values = Arrays.asList(argumentCaptor.getValue()); List<String> 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<String> toStringList(CharSequence[] charSequences) { List<String> 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(), Loading Loading
tests/robotests/src/com/android/settings/notification/VisibilityPreferenceControllerTest.java +17 −6 Original line number Diff line number Diff line Loading @@ -205,9 +205,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> 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)); } Loading @@ -223,9 +224,10 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> 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)); } Loading @@ -238,15 +240,24 @@ public class VisibilityPreferenceControllerTest { RestrictedDropDownPreference pref = mock(RestrictedDropDownPreference.class); mController.updateState(pref); ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class); ArgumentCaptor<CharSequence[]> argumentCaptor = ArgumentCaptor.forClass(CharSequence[].class); verify(pref, times(1)).setEntryValues(argumentCaptor.capture()); List<String> values = Arrays.asList(argumentCaptor.getValue()); List<String> 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<String> toStringList(CharSequence[] charSequences) { List<String> 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(), Loading