### Question:
Utils { public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_resolutions_key), false); String preferredFormatString = PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(R.string.preferred_video_format_key), context.getString(R.string.preferred_video_format_default)); MediaFormat preferredFormat = MediaFormat.WEBM; switch (preferredFormatString) { case "WebM": preferredFormat = MediaFormat.WEBM; break; case "MPEG-4": preferredFormat = MediaFormat.MPEG_4; break; case "3GPP": preferredFormat = MediaFormat.v3GPP; break; default: break; } return getSortedStreamVideosList(preferredFormat, showHigherResolutions, videoStreams, videoOnlyStreams, ascendingOrder); }  static int getDefaultResolution(String defaultResolution, String preferredFormat, List<VideoStream> videoStreams); static int getDefaultResolution(Context context, List<VideoStream> videoStreams); static int getPopupDefaultResolution(Context context, List<VideoStream> videoStreams); static int getPreferredAudioFormat(Context context, List<AudioStream> audioStreams); static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams); static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder); static ArrayList<VideoStream> getSortedStreamVideosList(MediaFormat preferredFormat, boolean showHigherResolutions, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder); static void sortStreamList(List<VideoStream> videoStreams, final boolean ascendingOrder);  }### Answer:
@Test public void getSortedStreamVideosListTest() throws Exception { List<VideoStream> result = Utils.getSortedStreamVideosList(MediaFormat.MPEG_4, true, videoStreamsTestList, videoOnlyStreamsTestList, 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 = Utils.getSortedStreamVideosList(MediaFormat.MPEG_4, true, videoStreamsTestList, videoOnlyStreamsTestList, 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)); result = Utils.getSortedStreamVideosList(MediaFormat.MPEG_4, false, videoStreamsTestList, videoOnlyStreamsTestList, false); 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)); }