fix failing tests

This commit is contained in:
Christian Schabesberger 2019-01-18 12:44:34 +01:00
parent 6776abdd55
commit 99915e4527
2 changed files with 15 additions and 82 deletions

View File

@ -254,8 +254,8 @@ public class StreamInfo extends Info {
} }
private StreamType streamType; private StreamType streamType;
private String thumbnailUrl; private String thumbnailUrl = "";
private String uploadDate; private String uploadDate = "";
private long duration = -1; private long duration = -1;
private int ageLimit = -1; private int ageLimit = -1;
private String description; private String description;
@ -264,26 +264,26 @@ public class StreamInfo extends Info {
private long likeCount = -1; private long likeCount = -1;
private long dislikeCount = -1; private long dislikeCount = -1;
private String uploaderName; private String uploaderName = "";
private String uploaderUrl; private String uploaderUrl = "";
private String uploaderAvatarUrl; private String uploaderAvatarUrl = "";
private List<VideoStream> videoStreams; private List<VideoStream> videoStreams = new ArrayList<>();
private List<AudioStream> audioStreams; private List<AudioStream> audioStreams = new ArrayList<>();
private List<VideoStream> videoOnlyStreams; private List<VideoStream> videoOnlyStreams = new ArrayList<>();
private String dashMpdUrl; private String dashMpdUrl = "";
private List<VideoStream> segmentedVideoStreams; private List<VideoStream> segmentedVideoStreams = new ArrayList<>();
private List<AudioStream> segmentedAudioStreams; private List<AudioStream> segmentedAudioStreams = new ArrayList<>();
private List<VideoStream> segmentedVideoOnlyStreams; private List<VideoStream> segmentedVideoOnlyStreams = new ArrayList<>();
private String hlsUrl; private String hlsUrl = "";
private StreamInfoItem nextVideo; private StreamInfoItem nextVideo;
private List<InfoItem> relatedStreams; private List<InfoItem> relatedStreams = new ArrayList<>();
private long startPosition = 0; private long startPosition = 0;
private List<SubtitlesStream> subtitles; private List<SubtitlesStream> subtitles = new ArrayList<>();
/** /**
* Get the stream type * Get the stream type

View File

@ -1,67 +0,0 @@
package org.schabi.newpipe.extractor.services.youtube;
/*
* Created by Christian Schabesberger on 30.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* YoutubeVideoExtractorDefault.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
import org.junit.BeforeClass;
import org.junit.Test;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.utils.Localization;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/**
* Test for {@link StreamExtractor}
*/
public class YoutubeStreamExtractorDASHTest {
private static StreamInfo info;
@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
info = StreamInfo.getInfo(YouTube, "https://www.youtube.com/watch?v=00Q4SUnVQK4");
}
@Test
public void testGetDashMpd() {
assertTrue(info.getDashMpdUrl(),
info.getDashMpdUrl() != null && !info.getDashMpdUrl().isEmpty());
}
@Test
public void testRegularStreams() {
assertEquals(0, info.getAudioStreams().size());
assertEquals(0, info.getVideoOnlyStreams().size());
assertEquals(4, info.getVideoStreams().size());
}
@Test
public void testSegmentedStreams() {
assertEquals(2, info.getSegmentedAudioStreams().size());
assertEquals(3, info.getSegmentedVideoOnlyStreams().size());
assertEquals(0, info.getSegmentedVideoStreams().size());
}
}