### Question:
ListHelper { public static List<VideoStream> getSortedStreamVideosList(final Context context, final List<VideoStream> videoStreams, final List<VideoStream> videoOnlyStreams, final boolean ascendingOrder) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); boolean showHigherResolutions = preferences.getBoolean( context.getString(R.string.show_higher_resolutions_key), false); MediaFormat defaultFormat = getDefaultFormat(context, R.string.default_video_format_key, R.string.default_video_format_value); return getSortedStreamVideosList(defaultFormat, showHigherResolutions, videoStreams, videoOnlyStreams, ascendingOrder); } private  ListHelper(); static int getDefaultResolutionIndex(final Context context,
                                                final List<VideoStream> videoStreams); static int getResolutionIndex(final Context context,
                                         final List<VideoStream> videoStreams,
                                         final String defaultResolution); static int getPopupDefaultResolutionIndex(final Context context,
                                                     final List<VideoStream> videoStreams); static int getPopupResolutionIndex(final Context context,
                                              final List<VideoStream> videoStreams,
                                              final String defaultResolution); static int getDefaultAudioFormat(final Context context,
                                            final List<AudioStream> audioStreams); static List<VideoStream> getSortedStreamVideosList(final Context context,
                                                              final List<VideoStream> videoStreams,
                                                              final List<VideoStream>
                                                                      videoOnlyStreams,
                                                              final boolean ascendingOrder);  }### Answer:
@Test public void getSortedStreamVideosListTest() { List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true, VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, true); List<String> expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60"); assertEquals(result.size(), expected.size()); for (int i = 0; i < result.size(); i++) { assertEquals(result.get(i).resolution, expected.get(i)); } result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true, VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, false); expected = Arrays.asList("2160p60", "2160p", "1440p60", "1080p60", "1080p", "720p60", "720p", "480p", "360p", "240p", "144p"); assertEquals(result.size(), expected.size()); for (int i = 0; i < result.size(); i++) { assertEquals(result.get(i).resolution, expected.get(i)); } }
@Test public void getSortedStreamVideosExceptHighResolutionsTest() { List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, false, VIDEO_STREAMS_TEST_LIST, VIDEO_ONLY_STREAMS_TEST_LIST, false); List<String> expected = Arrays.asList( "1080p60", "1080p", "720p60", "720p", "480p", "360p", "240p", "144p"); assertEquals(result.size(), expected.size()); for (int i = 0; i < result.size(); i++) { assertEquals(result.get(i).resolution, expected.get(i)); } }