diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-03-24 20:00:45 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-03-25 13:14:33 +0100 |
commit | 7f1143edde3ed44f05f2434685f6c819a28a7579 (patch) | |
tree | 9938da37676ab52ef031fb6823cef141cf8ddc1b | |
parent | bae78fe7af98b4d7fa8a99a1c30610188e20f55c (diff) | |
download | AntennaPod-7f1143edde3ed44f05f2434685f6c819a28a7579.zip |
Fix or improve tests
5 files changed, 9 insertions, 4 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java index 526663979..f420d24d2 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java @@ -53,7 +53,10 @@ public class PlaybackServiceMediaPlayerTest extends InstrumentationTestCase { super.setUp(); assertionError = null; + final Context context = getInstrumentation().getTargetContext(); + // create new database + PodDBAdapter.init(context); PodDBAdapter.deleteDatabase(); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); @@ -62,7 +65,6 @@ public class PlaybackServiceMediaPlayerTest extends InstrumentationTestCase { httpServer = new HTTPBin(); httpServer.start(); - final Context context = getInstrumentation().getTargetContext(); File cacheDir = context.getExternalFilesDir("testFiles"); if (cacheDir == null) cacheDir = context.getExternalFilesDir("testFiles"); diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java index 5c3d32960..6ab6e5c61 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java @@ -34,6 +34,7 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase { super.setUp(); // create new database + PodDBAdapter.init(getInstrumentation().getTargetContext()); PodDBAdapter.deleteDatabase(); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBNullCleanupAlgorithmTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBNullCleanupAlgorithmTest.java index 74b34a176..7925941ec 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBNullCleanupAlgorithmTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBNullCleanupAlgorithmTest.java @@ -58,7 +58,7 @@ public class DBNullCleanupAlgorithmTest extends InstrumentationTestCase { assertTrue(destFolder.canWrite()); // create new database - PodDBAdapter.init(getInstrumentation().getTargetContext()); + PodDBAdapter.init(context); PodDBAdapter.deleteDatabase(); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java index 3d4e78f8f..785d32e93 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java @@ -39,7 +39,7 @@ public class DBTasksTest extends InstrumentationTestCase { context = getInstrumentation().getTargetContext(); // create new database - PodDBAdapter.init(getInstrumentation().getTargetContext()); + PodDBAdapter.init(context); PodDBAdapter.deleteDatabase(); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java index 4e214cf81..d4c9fa2f7 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -41,10 +41,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv @Override protected void setUp() throws Exception { super.setUp(); - uiTestUtils = new UITestUtils(getInstrumentation().getTargetContext()); + Context context = getInstrumentation().getTargetContext(); + uiTestUtils = new UITestUtils(context); uiTestUtils.setup(); // create new database + PodDBAdapter.init(context); PodDBAdapter.deleteDatabase(); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); |