CommentTable { public boolean areNewComments(int photoId, String etag){ String storedEtag = this.loadEtag(photoId); return etag != null && !etag.equals(storedEtag); } CommentTable(DbConnection dbHelper); void openDatabase(); void closeDatabase(); boolean areNewComments(int photoId, String etag); long insertOrReplaceComments(int photoId, String comments, String etag); String loadEtag(int photoId); String loadComments(int photoId); static final String TABLE_NAME; static final String COLUMN_PHOTO_ID; static final String COLUMN_COMMENTS; static final String COLUMN_ETAG; static final String TABLE_CREATE; static final String TABLE_DROP; }
@Test public void areNewComments(){ internalInsertComments(); assertTrue(commentTable.areNewComments(PHOTO_ID, SOME_OTHER_ETAG_VALUE)); }
@Test public void areNotNewComments(){ internalInsertComments(); assertFalse(commentTable.areNewComments(PHOTO_ID, SOME_ETAG_VALUE)); }