|
49 | 49 | import org.schabi.newpipe.extractor.stream.StreamExtractor; |
50 | 50 | import org.schabi.newpipe.extractor.stream.StreamSegment; |
51 | 51 | import org.schabi.newpipe.extractor.stream.StreamType; |
| 52 | +import org.schabi.newpipe.extractor.utils.LocaleCompat; |
52 | 53 |
|
53 | 54 | import java.io.IOException; |
54 | 55 | import java.net.MalformedURLException; |
55 | 56 | import java.net.URL; |
56 | 57 | import java.util.Arrays; |
57 | 58 | import java.util.Collections; |
58 | 59 | import java.util.List; |
| 60 | +import java.util.Locale; |
| 61 | +import java.util.Objects; |
59 | 62 |
|
60 | 63 | import javax.annotation.Nullable; |
61 | 64 |
|
@@ -547,19 +550,20 @@ public static void setUp() throws Exception { |
547 | 550 |
|
548 | 551 | @Test |
549 | 552 | void testCheckAudioStreams() throws Exception { |
550 | | - assertFalse(extractor.getAudioStreams().isEmpty()); |
| 553 | + final List<AudioStream> audioStreams = extractor.getAudioStreams(); |
| 554 | + assertFalse(audioStreams.isEmpty()); |
551 | 555 |
|
552 | | - for (final AudioStream audioStream : extractor.getAudioStreams()) { |
553 | | - assertNotNull(audioStream.getAudioTrackName()); |
| 556 | + for (final AudioStream stream : audioStreams) { |
| 557 | + assertNotNull(stream.getAudioTrackName()); |
554 | 558 | } |
555 | 559 |
|
556 | | - assertTrue(extractor.getAudioStreams() |
557 | | - .stream() |
| 560 | + assertTrue(audioStreams.stream() |
558 | 561 | .anyMatch(audioStream -> "English".equals(audioStream.getAudioTrackName()))); |
559 | 562 |
|
560 | | - assertTrue(extractor.getAudioStreams() |
561 | | - .stream() |
562 | | - .anyMatch(audioStream -> "Hindi".equals(audioStream.getAudioTrackName()))); |
| 563 | + final Locale hindiLocale = LocaleCompat.forLanguageTag("hi"); |
| 564 | + assertTrue(audioStreams.stream() |
| 565 | + .anyMatch(audioStream -> |
| 566 | + Objects.equals(audioStream.getAudioLocale(), hindiLocale))); |
563 | 567 | } |
564 | 568 | } |
565 | 569 |
|
|
0 commit comments