Remove unnecessary file object creation
This commit is contained in:
parent
255c726f20
commit
f91916c017
|
@ -10,6 +10,10 @@ public class DownloaderFactory {
|
||||||
|
|
||||||
private final static DownloaderType DEFAULT_DOWNLOADER = DownloaderType.REAL;
|
private final static DownloaderType DEFAULT_DOWNLOADER = DownloaderType.REAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param path The path to the folder where mocks are saved/retrieved.
|
||||||
|
* Preferably starting with {@link DownloaderFactory#RESOURCE_PATH}
|
||||||
|
*/
|
||||||
public Downloader getDownloader(String path) throws IOException {
|
public Downloader getDownloader(String path) throws IOException {
|
||||||
DownloaderType type;
|
DownloaderType type;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -54,8 +54,7 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
YoutubeParsingHelper.resetClientVersionAndKey();
|
YoutubeParsingHelper.resetClientVersionAndKey();
|
||||||
final File file = new File(RESOURCE_PATH + "mix");
|
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "mix"));
|
||||||
NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath()));
|
|
||||||
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RD" + VIDEO_ID);
|
"https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RD" + VIDEO_ID);
|
||||||
|
@ -133,8 +132,7 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
YoutubeParsingHelper.resetClientVersionAndKey();
|
YoutubeParsingHelper.resetClientVersionAndKey();
|
||||||
final File file = new File(RESOURCE_PATH + "mixWithIndex");
|
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "mixWithIndex"));
|
||||||
NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath()));
|
|
||||||
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/watch?v=" + VIDEO_ID_NUMBER_13 + "&list=RD"
|
"https://www.youtube.com/watch?v=" + VIDEO_ID_NUMBER_13 + "&list=RD"
|
||||||
|
@ -204,8 +202,7 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
YoutubeParsingHelper.resetClientVersionAndKey();
|
YoutubeParsingHelper.resetClientVersionAndKey();
|
||||||
final File file = new File(RESOURCE_PATH + "myMix");
|
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "myMix"));
|
||||||
NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath()));
|
|
||||||
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RDMM"
|
"https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RDMM"
|
||||||
|
@ -278,8 +275,7 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws IOException {
|
public static void setUp() throws IOException {
|
||||||
YoutubeParsingHelper.resetClientVersionAndKey();
|
YoutubeParsingHelper.resetClientVersionAndKey();
|
||||||
final File file = new File(RESOURCE_PATH + "invalid");
|
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "invalid"));
|
||||||
NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
@ -311,8 +307,7 @@ public class YoutubeMixPlaylistExtractorTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
YoutubeParsingHelper.resetClientVersionAndKey();
|
YoutubeParsingHelper.resetClientVersionAndKey();
|
||||||
final File file = new File(RESOURCE_PATH + "channelMix");
|
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "channelMix"));
|
||||||
NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath()));
|
|
||||||
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
extractor = (YoutubeMixPlaylistExtractor) YouTube
|
||||||
.getPlaylistExtractor(
|
.getPlaylistExtractor(
|
||||||
"https://www.youtube.com/watch?v=" + VIDEO_ID_OF_CHANNEL
|
"https://www.youtube.com/watch?v=" + VIDEO_ID_OF_CHANNEL
|
||||||
|
|
Loading…
Reference in New Issue