Switched to mockonly tests
* Made the reason why the tests are mockonly mandatory
This commit is contained in:
parent
0fceb4686b
commit
fcee247f9f
4 changed files with 31 additions and 16 deletions
|
@ -17,4 +17,9 @@ import java.lang.annotation.RetentionPolicy;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ExtendWith(MockOnlyCondition.class)
|
||||
public @interface MockOnly {
|
||||
|
||||
/**
|
||||
* The reason why the test is mockonly.
|
||||
*/
|
||||
String value();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package org.schabi.newpipe.extractor.services.youtube.search;
|
||||
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||
import org.schabi.newpipe.downloader.MockOnly;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
|
@ -14,9 +18,6 @@ import java.net.URLEncoder;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
|
||||
// Doesn't work with mocks. Makes request with different `dataToSend` I think
|
||||
public class YoutubeMusicSearchExtractorTest {
|
||||
public static class MusicSongs extends DefaultSearchExtractorTest {
|
||||
|
@ -130,7 +131,7 @@ public class YoutubeMusicSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; }
|
||||
}
|
||||
|
||||
@Disabled("Currently constantly switching between \"Did you mean\" and \"Showing results for ...\" occurs")
|
||||
@MockOnly("Currently constantly switching between \"Did you mean\" and \"Showing results for ...\" occurs")
|
||||
public static class Suggestion extends DefaultSearchExtractorTest {
|
||||
private static SearchExtractor extractor;
|
||||
private static final String QUERY = "megaman x3";
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
package org.schabi.newpipe.extractor.services.youtube.search;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmptyErrors;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoDuplicatedItems;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.CHANNELS;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.PLAYLISTS;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.VIDEOS;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.schabi.newpipe.downloader.DownloaderFactory;
|
||||
import org.schabi.newpipe.extractor.*;
|
||||
import org.schabi.newpipe.downloader.MockOnly;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.MetaInfo;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
|
@ -13,7 +29,6 @@ import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
|
|||
import org.schabi.newpipe.extractor.stream.Description;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
@ -22,13 +37,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmptyErrors;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoDuplicatedItems;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.*;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class YoutubeSearchExtractorTest {
|
||||
|
||||
|
@ -132,7 +141,7 @@ public class YoutubeSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||
}
|
||||
|
||||
@Disabled("Currently constantly switching between \"Did you mean\" and \"Showing results for ...\" occurs")
|
||||
@MockOnly("Currently constantly switching between \"Did you mean\" and \"Showing results for ...\" occurs")
|
||||
public static class Suggestion extends DefaultSearchExtractorTest {
|
||||
private static SearchExtractor extractor;
|
||||
private static final String QUERY = "newpip";
|
||||
|
|
|
@ -88,7 +88,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
|
|||
// @formatter:on
|
||||
|
||||
@Test
|
||||
@MockOnly // related items keep changing, and so do the mixes contained within them
|
||||
@MockOnly("related items keep changing, and so do the mixes contained within them")
|
||||
@Override
|
||||
public void testRelatedItems() throws Exception {
|
||||
super.testRelatedItems();
|
||||
|
|
Loading…
Reference in a new issue