Move test mp3s to androidTest directory

This commit is contained in:
TacoTheDank 2022-05-15 15:02:21 -04:00
parent 0fbc6992a1
commit 0e96df3cba
4 changed files with 6 additions and 2 deletions

View File

@ -85,7 +85,7 @@ public class PlaybackServiceMediaPlayerTest {
assertTrue(cacheDir.canWrite()); assertTrue(cacheDir.canWrite());
assertTrue(cacheDir.canRead()); assertTrue(cacheDir.canRead());
if (!dest.exists()) { if (!dest.exists()) {
InputStream i = getInstrumentation().getTargetContext().getAssets().open("3sec.mp3"); InputStream i = getInstrumentation().getContext().getAssets().open("3sec.mp3");
OutputStream o = new FileOutputStream(new File(cacheDir, PLAYABLE_DEST_URL)); OutputStream o = new FileOutputStream(new File(cacheDir, PLAYABLE_DEST_URL));
IOUtils.copy(i, o); IOUtils.copy(i, o);
o.flush(); o.flush();

View File

@ -2,6 +2,9 @@ package de.test.antennapod.ui;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.QueueEvent; import de.danoeh.antennapod.event.QueueEvent;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
@ -99,7 +102,8 @@ public class UITestUtils {
} }
Assert.assertFalse(mediaFile.exists()); Assert.assertFalse(mediaFile.exists());
InputStream in = context.getAssets().open(testFileName); InputStream in = InstrumentationRegistry.getInstrumentation().getContext()
.getAssets().open(testFileName);
Assert.assertNotNull(in); Assert.assertNotNull(in);
FileOutputStream out = new FileOutputStream(mediaFile); FileOutputStream out = new FileOutputStream(mediaFile);