I am new to android testing and trying to write unit tests (running on local jvm) using mockito in Android Studio.
My IDE setup (gradle scripts) is done so far.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Unit testing dependencies.
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}
In my app I am using greendao
as ORM but have no abstraction of this layer yet (planned for future).
When I try to test parts of my application code which are using database related classes (like SqliteOpenHelper
, SqliteDatabase
for setting up database, SQLiteStatement
for compiling statements, etc.) the test exits with exception, for example with SQLiteOpenHelper not mocked .
Is it at all possible to write unit tests in this scenario mocking the database (without investing now time to abstract the database layer)?