Tests: Initialize DB adapter

This commit is contained in:
Martin Fietz 2016-03-22 18:49:45 +01:00
parent a7368eadd9
commit 391d059252
5 changed files with 5 additions and 3 deletions

View File

@ -70,6 +70,7 @@ public class DBCleanupTests extends InstrumentationTestCase {
assertTrue(destFolder.canWrite()); assertTrue(destFolder.canWrite());
// create new database // create new database
PodDBAdapter.init(context);
PodDBAdapter.deleteDatabase(); PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance(); PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();

View File

@ -19,8 +19,6 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import static de.test.antennapod.storage.DBTestUtils.saveFeedlist;
/** /**
* Tests that the APNullCleanupAlgorithm is working correctly. * Tests that the APNullCleanupAlgorithm is working correctly.
*/ */
@ -60,6 +58,7 @@ public class DBNullCleanupAlgorithmTest extends InstrumentationTestCase {
assertTrue(destFolder.canWrite()); assertTrue(destFolder.canWrite());
// create new database // create new database
PodDBAdapter.init(getInstrumentation().getTargetContext());
PodDBAdapter.deleteDatabase(); PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance(); PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();

View File

@ -34,6 +34,7 @@ public class DBReaderTest extends InstrumentationTestCase {
super.setUp(); super.setUp();
// create new database // create new database
PodDBAdapter.init(getInstrumentation().getTargetContext());
PodDBAdapter.deleteDatabase(); PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance(); PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();

View File

@ -28,7 +28,6 @@ public class DBTasksTest extends InstrumentationTestCase {
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();
assertTrue(PodDBAdapter.deleteDatabase()); assertTrue(PodDBAdapter.deleteDatabase());
} }
@ -38,6 +37,7 @@ public class DBTasksTest extends InstrumentationTestCase {
context = getInstrumentation().getTargetContext(); context = getInstrumentation().getTargetContext();
// create new database // create new database
PodDBAdapter.init(getInstrumentation().getTargetContext());
PodDBAdapter.deleteDatabase(); PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance(); PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();

View File

@ -53,6 +53,7 @@ public class DBWriterTest extends InstrumentationTestCase {
super.setUp(); super.setUp();
// create new database // create new database
PodDBAdapter.init(getInstrumentation().getTargetContext());
PodDBAdapter.deleteDatabase(); PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance(); PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();