public abstract class DbTest
extends android.test.AndroidTestCase
Context
). Also, offers some convenience methods to create new Application
objects similar to
ApplicationTestCase
.
Unlike ApplicationTestCase, this class should behave more correctly when you call createApplication(Class)
during setUp()
: ApplicationTestCase.testApplicationTestCaseSetUpProperly()
leaves
Application objects un-terminated.Modifier and Type | Field and Description |
---|---|
protected android.database.sqlite.SQLiteDatabase |
db |
static java.lang.String |
DB_NAME |
protected boolean |
inMemory |
protected java.util.Random |
random |
Modifier and Type | Method and Description |
---|---|
<T extends android.app.Application> |
createApplication(java.lang.Class<T> appClass)
Returns a prepared application with the onCreate method already called.
|
protected android.database.sqlite.SQLiteDatabase |
createDatabase()
May be overriden by sub classes to set up a different db.
|
<T extends android.app.Application> |
getApplication()
Gets the previously created application.
|
protected void |
logTableDump(java.lang.String tablename) |
protected void |
setUp() |
protected void |
tearDown() |
void |
terminateApplication()
Terminates a previously created application.
|
assertActivityRequiresPermission, assertReadingContentUriRequiresPermission, assertWritingContentUriRequiresPermission, getContext, scrubClass, setContext, testAndroidTestCaseSetupProperly
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
public static final java.lang.String DB_NAME
protected final java.util.Random random
protected final boolean inMemory
protected android.database.sqlite.SQLiteDatabase db
protected void setUp() throws java.lang.Exception
setUp
in class android.test.AndroidTestCase
java.lang.Exception
public <T extends android.app.Application> T createApplication(java.lang.Class<T> appClass)
public void terminateApplication()
tearDown()
if needed.public <T extends android.app.Application> T getApplication()
protected android.database.sqlite.SQLiteDatabase createDatabase()
protected void tearDown() throws java.lang.Exception
tearDown
in class android.test.AndroidTestCase
java.lang.Exception
protected void logTableDump(java.lang.String tablename)
Available under the Apache License, Version 2.0 - Copyright © 2011-2015 greenrobot.de. All Rights Reserved.