Created
November 9, 2018 23:55
-
-
Save BrantApps/4d18b8f86e9740c4f91a0cc2f14b9db1 to your computer and use it in GitHub Desktop.
An older way of doing in-memory dbs on Android without Room.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.brantapps.oceanlife.domain.fixture; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import org.robolectric.RuntimeEnvironment; | |
/** | |
* In memory database for testing purposes. | |
* | |
* Created by davidb on 29/09/15. | |
*/ | |
public class InMemoryDatabase extends SQLiteOpenHelper { | |
public InMemoryDatabase(int version) { | |
super(RuntimeEnvironment.application, null, null, version); | |
} | |
@Override | |
public void onCreate(SQLiteDatabase db) { | |
// No-op test db! - fixtures will be added by the tests cases | |
} | |
@Override | |
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |
// No-op test db! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment