Assert clearDatabase function
authorReto Buerki <reet@codelabs.ch>
Thu, 29 Mar 2012 11:48:03 +0000 (13:48 +0200)
committerReto Buerki <reet@codelabs.ch>
Thu, 29 Mar 2012 11:48:03 +0000 (13:48 +0200)
src/ch/codelabs/gitter/test/CommitDbAdapterTest.java

index db63756..a2e5e96 100644 (file)
@@ -86,8 +86,6 @@ public class CommitDbAdapterTest extends AndroidTestCase {
                assertEquals(0,
                                i.getInt(i.getColumnIndexOrThrow(CommitDbAdapter.KEY_READ)));
 
-               commitDbAdapter.deleteCommit(id);
-
                /* Test latest commit getter, insert another commit first */
                final String testHash2 = "abca3c29b985d90f271c7b9ea9f095729759799c";
                commit.mCommitId = testHash2;
@@ -97,8 +95,12 @@ public class CommitDbAdapterTest extends AndroidTestCase {
                assertEquals(testHash2,
                                i.getString(i.getColumnIndexOrThrow(CommitDbAdapter.KEY_HASH)));
 
-               commitDbAdapter.deleteCommit(id);
+               commitDbAdapter.clearDatabase();
+               i = commitDbAdapter.fetchAllCommits();
+               assertTrue(i.getCount() == 0);
+
                c.close();
+               i.close();
                commitDbAdapter.close();
        }
 }