Fix ListHelperTest failure caused by immutable list being used
This commit is contained in:
parent
cacce6d2d0
commit
f4fe5fcb16
|
@ -230,14 +230,15 @@ public final class ListHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the index of the default stream in the list, based on the parameters
|
* Return the index of the default stream in the list, that will be sorted in the process, based
|
||||||
* defaultResolution and defaultFormat.
|
* on the parameters defaultResolution and defaultFormat.
|
||||||
*
|
*
|
||||||
* @param defaultResolution the default resolution to look for
|
* @param defaultResolution the default resolution to look for
|
||||||
* @param bestResolutionKey key of the best resolution
|
* @param bestResolutionKey key of the best resolution
|
||||||
* @param defaultFormat the default format to look for
|
* @param defaultFormat the default format to look for
|
||||||
* @param videoStreams list of the video streams to check
|
* @param videoStreams a mutable list of the video streams to check (it will be sorted in
|
||||||
* @return index of the default resolution&format
|
* place)
|
||||||
|
* @return index of the default resolution&format in the sorted videoStreams
|
||||||
*/
|
*/
|
||||||
static int getDefaultResolutionIndex(final String defaultResolution,
|
static int getDefaultResolutionIndex(final String defaultResolution,
|
||||||
final String bestResolutionKey,
|
final String bestResolutionKey,
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class ListHelperTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getDefaultResolutionTest() {
|
public void getDefaultResolutionTest() {
|
||||||
final List<VideoStream> testList = List.of(
|
final List<VideoStream> testList = new ArrayList<>(List.of(
|
||||||
generateVideoStream("mpeg_4-720", MediaFormat.MPEG_4, "720p", false),
|
generateVideoStream("mpeg_4-720", MediaFormat.MPEG_4, "720p", false),
|
||||||
generateVideoStream("v3gpp-240", MediaFormat.v3GPP, "240p", false),
|
generateVideoStream("v3gpp-240", MediaFormat.v3GPP, "240p", false),
|
||||||
generateVideoStream("webm-480", MediaFormat.WEBM, "480p", false),
|
generateVideoStream("webm-480", MediaFormat.WEBM, "480p", false),
|
||||||
|
@ -148,7 +148,7 @@ public class ListHelperTest {
|
||||||
generateVideoStream("mpeg_4-240", MediaFormat.MPEG_4, "240p", false),
|
generateVideoStream("mpeg_4-240", MediaFormat.MPEG_4, "240p", false),
|
||||||
generateVideoStream("webm-144", MediaFormat.WEBM, "144p", false),
|
generateVideoStream("webm-144", MediaFormat.WEBM, "144p", false),
|
||||||
generateVideoStream("mpeg_4-360", MediaFormat.MPEG_4, "360p", false),
|
generateVideoStream("mpeg_4-360", MediaFormat.MPEG_4, "360p", false),
|
||||||
generateVideoStream("webm-360", MediaFormat.WEBM, "360p", false));
|
generateVideoStream("webm-360", MediaFormat.WEBM, "360p", false)));
|
||||||
VideoStream result = testList.get(ListHelper.getDefaultResolutionIndex(
|
VideoStream result = testList.get(ListHelper.getDefaultResolutionIndex(
|
||||||
"720p", BEST_RESOLUTION_KEY, MediaFormat.MPEG_4, testList));
|
"720p", BEST_RESOLUTION_KEY, MediaFormat.MPEG_4, testList));
|
||||||
assertEquals("720p", result.getResolution());
|
assertEquals("720p", result.getResolution());
|
||||||
|
|
Loading…
Reference in New Issue