junit.framework.AssertionFailedError

时间:2015-04-29 10:35:47

标签: android sqlite junit

我得到错误:

  

junit.framework.AssertionFailedError at   com.example.sirivan.myfirstapp.test.TestDb.testCreateDb(TestDb.java:22)

TestDb.java

public class TestDb extends AndroidTestCase {
    public static final String LOG_TAG = TestDb.class.getSimpleName();

    public void testCreateDb() throws Throwable{
        assertTrue(mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME));
        SQLiteDatabase db = new WeatherDbHelper(
            this.mContext).getWritableDatabase();
            assertEquals(true, db.isOpen());
        db.close();
    }
}

1 个答案:

答案 0 :(得分:0)

遵循文件:

http://developer.android.com/reference/android/content/Context.html#deleteDatabase(java.lang.String)

  

如果成功删除了数据库,则返回true;别的假。