1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-03-25 19:34:47 +01:00
commit 18301d8f8b

View File

@ -2,16 +2,15 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.SearchResult;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamPreviewInfo;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.services.youtube.YoutubeSearchEngine;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.services.youtube.YoutubeService;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
/**
@ -44,13 +43,13 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
SearchEngine engine = ServiceList.getService("Youtube")
.getSearchEngineInstance(new Downloader());
result = engine.search("lefloid",
result = engine.search("adele",
0, "de", new Downloader()).getSearchResult();
suggestionReply = engine.suggestionList("hello","de",new Downloader());
}
public void testIfNoErrorOccur() {
assertTrue(result.errors.isEmpty() ? "" : ExceptionUtils.getStackTrace(result.errors.get(0))
assertTrue(result.errors.isEmpty() ? "" : getStackTrace(result.errors.get(0))
,result.errors.isEmpty());
}
@ -118,4 +117,11 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
assertTrue(s, !s.isEmpty());
}
}
private static String getStackTrace(final Throwable throwable) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw, true);
throwable.printStackTrace(pw);
return sw.getBuffer().toString();
}
}