fixed failing unit test

This commit is contained in:
Christian Schabesberger 2016-03-01 23:54:26 +01:00
parent 781bf8e7ec
commit 97d76aee18
1 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,8 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.schabi.newpipe.extractor.SearchResult;
import org.schabi.newpipe.extractor.StreamPreviewInfo; import org.schabi.newpipe.extractor.StreamPreviewInfo;
import org.schabi.newpipe.extractor.SearchEngine; import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.services.youtube.YoutubeSearchEngine; import org.schabi.newpipe.extractor.services.youtube.YoutubeSearchEngine;
@ -30,7 +32,7 @@ import java.util.ArrayList;
*/ */
public class YoutubeSearchEngineTest extends AndroidTestCase { public class YoutubeSearchEngineTest extends AndroidTestCase {
private SearchEngine.Result result; private SearchResult result;
private ArrayList<String> suggestionReply; private ArrayList<String> suggestionReply;
@Override @Override
@ -39,12 +41,13 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
SearchEngine engine = new YoutubeSearchEngine(); SearchEngine engine = new YoutubeSearchEngine();
result = engine.search("bla", result = engine.search("bla",
0, "de", new Downloader()); 0, "de", new Downloader()).getSearchResult();
suggestionReply = engine.suggestionList("hello","de",new Downloader()); suggestionReply = engine.suggestionList("hello","de",new Downloader());
} }
public void testIfNoErrorOccur() { public void testIfNoErrorOccur() {
assertEquals(result.errorMessage, ""); assertTrue(result.errors.isEmpty() ? "" : ExceptionUtils.getStackTrace(result.errors.get(0))
,result.errors.isEmpty());
} }
public void testIfListIsNotEmpty() { public void testIfListIsNotEmpty() {