mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-01-07 18:10:34 +05:30
[Test] Improve code style and add final
This commit is contained in:
parent
a4097d8d01
commit
a087b092b4
@ -95,7 +95,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||||||
assertNotNull(description);
|
assertNotNull(description);
|
||||||
assertFalse("description is empty", description.getContent().isEmpty());
|
assertFalse("description is empty", description.getContent().isEmpty());
|
||||||
|
|
||||||
for (String s : expectedDescriptionContains()) {
|
for (final String s : expectedDescriptionContains()) {
|
||||||
assertThat(description.getContent(), containsString(s));
|
assertThat(description.getContent(), containsString(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVideoStreams() throws Exception {
|
public void testVideoStreams() throws Exception {
|
||||||
List<VideoStream> videoStreams = extractor().getVideoStreams();
|
final List<VideoStream> videoStreams = extractor().getVideoStreams();
|
||||||
final List<VideoStream> videoOnlyStreams = extractor().getVideoOnlyStreams();
|
final List<VideoStream> videoOnlyStreams = extractor().getVideoOnlyStreams();
|
||||||
assertNotNull(videoStreams);
|
assertNotNull(videoStreams);
|
||||||
assertNotNull(videoOnlyStreams);
|
assertNotNull(videoOnlyStreams);
|
||||||
@ -202,11 +202,11 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||||||
if (expectedHasVideoStreams()) {
|
if (expectedHasVideoStreams()) {
|
||||||
assertFalse(videoStreams.isEmpty());
|
assertFalse(videoStreams.isEmpty());
|
||||||
|
|
||||||
for (VideoStream stream : videoStreams) {
|
for (final VideoStream stream : videoStreams) {
|
||||||
assertIsSecureUrl(stream.getUrl());
|
assertIsSecureUrl(stream.getUrl());
|
||||||
assertFalse(stream.getResolution().isEmpty());
|
assertFalse(stream.getResolution().isEmpty());
|
||||||
|
|
||||||
int formatId = stream.getFormatId();
|
final int formatId = stream.getFormatId();
|
||||||
assertTrue("format id does not fit a video stream: " + formatId,
|
assertTrue("format id does not fit a video stream: " + formatId,
|
||||||
0 <= formatId && formatId < 0x100);
|
0 <= formatId && formatId < 0x100);
|
||||||
}
|
}
|
||||||
@ -224,10 +224,10 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||||||
if (expectedHasAudioStreams()) {
|
if (expectedHasAudioStreams()) {
|
||||||
assertFalse(audioStreams.isEmpty());
|
assertFalse(audioStreams.isEmpty());
|
||||||
|
|
||||||
for (AudioStream stream : audioStreams) {
|
for (final AudioStream stream : audioStreams) {
|
||||||
assertIsSecureUrl(stream.getUrl());
|
assertIsSecureUrl(stream.getUrl());
|
||||||
|
|
||||||
int formatId = stream.getFormatId();
|
final int formatId = stream.getFormatId();
|
||||||
assertTrue("format id does not fit an audio stream: " + formatId,
|
assertTrue("format id does not fit an audio stream: " + formatId,
|
||||||
0x100 <= formatId && formatId < 0x1000);
|
0x100 <= formatId && formatId < 0x1000);
|
||||||
}
|
}
|
||||||
@ -239,28 +239,28 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testSubtitles() throws Exception {
|
public void testSubtitles() throws Exception {
|
||||||
List<SubtitlesStream> subtitles = extractor().getSubtitlesDefault();
|
final List<SubtitlesStream> subtitles = extractor().getSubtitlesDefault();
|
||||||
assertNotNull(subtitles);
|
assertNotNull(subtitles);
|
||||||
|
|
||||||
if (expectedHasSubtitles()) {
|
if (expectedHasSubtitles()) {
|
||||||
assertFalse(subtitles.isEmpty());
|
assertFalse(subtitles.isEmpty());
|
||||||
|
|
||||||
for (SubtitlesStream stream : subtitles) {
|
for (final SubtitlesStream stream : subtitles) {
|
||||||
assertIsSecureUrl(stream.getUrl());
|
assertIsSecureUrl(stream.getUrl());
|
||||||
|
|
||||||
int formatId = stream.getFormatId();
|
final int formatId = stream.getFormatId();
|
||||||
assertTrue("format id does not fit an audio stream: " + formatId,
|
assertTrue("format id does not fit a subtitles stream: " + formatId,
|
||||||
0x1000 <= formatId && formatId < 0x10000);
|
0x1000 <= formatId && formatId < 0x10000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assertTrue(subtitles.isEmpty());
|
assertTrue(subtitles.isEmpty());
|
||||||
|
|
||||||
MediaFormat[] formats = {MediaFormat.VTT, MediaFormat.TTML, MediaFormat.TRANSCRIPT1,
|
final MediaFormat[] formats = {MediaFormat.VTT, MediaFormat.TTML, MediaFormat.SRT,
|
||||||
MediaFormat.TRANSCRIPT2, MediaFormat.TRANSCRIPT3, MediaFormat.SRT};
|
MediaFormat.TRANSCRIPT1, MediaFormat.TRANSCRIPT2, MediaFormat.TRANSCRIPT3};
|
||||||
for (MediaFormat format : formats) {
|
for (final MediaFormat format : formats) {
|
||||||
subtitles = extractor().getSubtitles(format);
|
final List<SubtitlesStream> formatSubtitles = extractor().getSubtitles(format);
|
||||||
assertNotNull(subtitles);
|
assertNotNull(formatSubtitles);
|
||||||
assertTrue(subtitles.isEmpty());
|
assertTrue(formatSubtitles.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user