Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This class contains a simple implementation of {@link Locale#forLanguageTag(String)} for Android
* API levels below 21 (Lollipop). This is needed as core library desugaring does not backport that
* method as of this writing.
*
* <br>
* Relevant issue: https://issuetracker.google.com/issues/171182330
*/
public final class LocaleCompat {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.schabi.newpipe.extractor.services.media_ccc;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContainsImageUrlInImageCollection;
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderTestImpl;
Expand All @@ -10,19 +15,13 @@
import org.schabi.newpipe.extractor.stream.AudioStream;
import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.utils.LocaleCompat;

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContainsImageUrlInImageCollection;
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
import javax.annotation.Nullable;

/**
* Test {@link MediaCCCStreamExtractor}
Expand Down Expand Up @@ -96,7 +95,7 @@ public void testAudioStreams() throws Exception {
super.testAudioStreams();
final List<AudioStream> audioStreams = extractor.getAudioStreams();
assertEquals(2, audioStreams.size());
final Locale expectedLocale = LocaleCompat.forLanguageTag("deu");
final Locale expectedLocale = Locale.forLanguageTag("deu");
assertTrue(audioStreams.stream().allMatch(audioStream ->
Objects.equals(audioStream.getAudioLocale(), expectedLocale)));
}
Expand Down Expand Up @@ -174,7 +173,7 @@ public void testAudioStreams() throws Exception {
super.testAudioStreams();
final List<AudioStream> audioStreams = extractor.getAudioStreams();
assertEquals(2, audioStreams.size());
final Locale expectedLocale = LocaleCompat.forLanguageTag("eng");
final Locale expectedLocale = Locale.forLanguageTag("eng");
assertTrue(audioStreams.stream().allMatch(audioStream ->
Objects.equals(audioStream.getAudioLocale(), expectedLocale)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.stream.StreamSegment;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.utils.LocaleCompat;

import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -560,7 +559,7 @@ void testCheckAudioStreams() throws Exception {
.anyMatch(audioStream ->
"English original".equals(audioStream.getAudioTrackName())));

final Locale hindiLocale = LocaleCompat.forLanguageTag("hi");
final Locale hindiLocale = Locale.forLanguageTag("hi");
assertTrue(audioStreams.stream()
.anyMatch(audioStream ->
Objects.equals(audioStream.getAudioLocale(), hindiLocale)));
Expand Down