Fix or improve tests
This commit is contained in:
parent
bae78fe7af
commit
7f1143edde
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue