diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2019-08-11 21:33:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-11 21:33:27 +0200 |
commit | 0680dfb0476b2c7ebd89ca30819a618291a252ad (patch) | |
tree | eb8de76f4a7f6b12d94ef50ceec5f112a2ee7232 /app/src/androidTest/java/de/test/antennapod/util/syndication | |
parent | ffe98e2225e7a0bd0169abc1cbf902db16fb278c (diff) | |
parent | c29b0ce8c760b75b4c61781acaf56542530ca3cc (diff) | |
download | AntennaPod-0680dfb0476b2c7ebd89ca30819a618291a252ad.zip |
Merge pull request #3317 from ByteHamster/tests
Tests
Diffstat (limited to 'app/src/androidTest/java/de/test/antennapod/util/syndication')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java index 809b9769a..d4837ef60 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java @@ -1,38 +1,43 @@ package de.test.antennapod.util.syndication; -import android.test.InstrumentationTestCase; - +import android.support.test.InstrumentationRegistry; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; import java.util.Map; import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * Test class for FeedDiscoverer */ -public class FeedDiscovererTest extends InstrumentationTestCase { +public class FeedDiscovererTest { private FeedDiscoverer fd; private File testDir; - @Override + @Before public void setUp() throws Exception { - super.setUp(); fd = new FeedDiscoverer(); - testDir = getInstrumentation().getTargetContext().getExternalFilesDir("FeedDiscovererTest"); + testDir = new File(InstrumentationRegistry.getTargetContext().getFilesDir(), "FeedDiscovererTest"); testDir.mkdir(); assertTrue(testDir.exists()); } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { FileUtils.deleteDirectory(testDir); - super.tearDown(); } private String createTestHtmlString(String rel, String type, String href, String title) { @@ -81,30 +86,37 @@ public class FeedDiscovererTest extends InstrumentationTestCase { } } + @Test public void testAlternateRSSWithTitleAbsolute() throws Exception { checkFindUrls(true, true, true, true, true); } + @Test public void testAlternateRSSWithTitleRelative() throws Exception { checkFindUrls(true, true, true, false, true); } + @Test public void testAlternateRSSNoTitleAbsolute() throws Exception { checkFindUrls(true, true, false, true, true); } + @Test public void testAlternateRSSNoTitleRelative() throws Exception { checkFindUrls(true, true, false, false, true); } + @Test public void testAlternateAtomWithTitleAbsolute() throws Exception { checkFindUrls(true, false, true, true, true); } + @Test public void testFeedAtomWithTitleAbsolute() throws Exception { checkFindUrls(false, false, true, true, true); } + @Test public void testAlternateRSSWithTitleAbsoluteFromFile() throws Exception { checkFindUrls(true, true, true, true, false); } |