Assert KEY_READ in commit test
[gitter-test.git] / src / ch / codelabs / gitter / test / CommitDbAdapterTest.java
index 1512c87..2b0ecb9 100644 (file)
@@ -34,16 +34,19 @@ public class CommitDbAdapterTest extends AndroidTestCase {
         * Insert commit into database.
         */
        public void testInsertCommit() {
-               CommitDbAdapter commitDbAdapter = new CommitDbAdapter(getContext());
+               final CommitDbAdapter commitDbAdapter = new
+                               CommitDbAdapter(getContext());
                commitDbAdapter.open();
 
-               long id = commitDbAdapter.insertCommit("Update TODO",
+               final long id = commitDbAdapter.insertCommit("Update TODO",
                                "John Doe doe@example.com", "http://1.com/abc", "testdata");
 
-               Cursor c = commitDbAdapter.fetchAllCommits();
+               final Cursor c = commitDbAdapter.fetchAllCommits();
                assertTrue(c.getCount() > 0);
 
-               c.moveToFirst();
+               c.moveToLast();
+               assertEquals(0, c.getInt
+                               (c.getColumnIndexOrThrow(CommitDbAdapter.KEY_READ)));
                assertEquals("Update TODO", c.getString
                                (c.getColumnIndexOrThrow(CommitDbAdapter.KEY_TITLE)));
                assertEquals("John Doe doe@example.com", c.getString