forked from upstream-mirrors/OpenTracks
Use an in-memory database when running instrumented tests.
- added new TestRunner and new TestApplication - The TestRunner loads TestApplication as the apps Application instance when running the tests - added new interface AppConfig to retrieve the database name - changed Startup (Application) so that it implements AppConfig - changed CustomSQLiteOpenHelper so that it retrieves the database name from the Application instance - Startup provides the production database name - TestApplication provides null which yields an in-mememory database
This commit is contained in:
@@ -14,7 +14,7 @@ import de.dennisguse.opentracks.settings.PreferencesUtils;
|
||||
* NOTE: How often actual application startup happens depends on the OS.
|
||||
* Not every start of an activity will trigger this.
|
||||
*/
|
||||
public class Startup extends Application {
|
||||
public class Startup extends Application implements AppConfig {
|
||||
|
||||
private static final String TAG = Startup.class.getSimpleName();
|
||||
|
||||
@@ -40,4 +40,9 @@ public class Startup extends Application {
|
||||
StrictMode.enableDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDatabaseName() {
|
||||
return "database.db";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user