@Test public void updatedArticleInsertedAt() { Article article = new Article(); article.id = 2L; article.insertedAt = 4L; ContentValues values = new ContentValues(); values.put("inserted_at", 4L); source.updateArticleInsertedAtTimestamp(article); verify(database).update("article", values, "_id=?", new String[] {"2"}); verifyNoMoreInteractions(database); }
public int updateArticleInsertedAtTimestamp(Article article) { ContentValues values = new ContentValues(1); values.put(ArticleModel.COLUMN_INSERTED_AT, article.insertedAt); return database.update( ArticleModel.TABLE, values, "_id=?", new String[] {Long.toString(article.id)}); }
DataSource { public int updateArticleInsertedAtTimestamp(Article article) { ContentValues values = new ContentValues(1); values.put(ArticleModel.COLUMN_INSERTED_AT, article.insertedAt); return database.update( ArticleModel.TABLE, values, "_id=?", new String[] {Long.toString(article.id)}); } }
DataSource { public int updateArticleInsertedAtTimestamp(Article article) { ContentValues values = new ContentValues(1); values.put(ArticleModel.COLUMN_INSERTED_AT, article.insertedAt); return database.update( ArticleModel.TABLE, values, "_id=?", new String[] {Long.toString(article.id)}); } private  DataSource(Context context); @VisibleForTesting  DataSource(DatabaseSQLiteHelper helper); @VisibleForTesting  DataSource(SQLiteDatabase database); }
DataSource { public int updateArticleInsertedAtTimestamp(Article article) { ContentValues values = new ContentValues(1); values.put(ArticleModel.COLUMN_INSERTED_AT, article.insertedAt); return database.update( ArticleModel.TABLE, values, "_id=?", new String[] {Long.toString(article.id)}); } private  DataSource(Context context); @VisibleForTesting  DataSource(DatabaseSQLiteHelper helper); @VisibleForTesting  DataSource(SQLiteDatabase database); static DataSource get(Context context); synchronized void open(); boolean isOpen(); synchronized void close(); @VisibleForTesting SQLiteDatabase getDatabase(); void clearTables(); void beginTransaction(); void execSql(String sql); Cursor rawQuery(String sql); void setTransactionSuccessful(); void endTransaction(); long insertArticle(Article article); int updateSavedArticleState(Article article); int updateArticleInsertedAtTimestamp(Article article); void updateArticleContent(Article article); Article getArticle(String url); Cursor getAllArticles(); Cursor getSavedArticles(); Cursor getArticlesForSource(long remoteSourceId); void deleteArticle(Article article); void deleteArticle(long articleId); long insertCategory(String categoryName); void insertSource(Source source); void deleteSource(String name); List<Source> getSources(); Source getSource(long remoteId); CategoryCounts getCategoryCounts(long timestamp); }
DataSource { public int updateArticleInsertedAtTimestamp(Article article) { ContentValues values = new ContentValues(1); values.put(ArticleModel.COLUMN_INSERTED_AT, article.insertedAt); return database.update( ArticleModel.TABLE, values, "_id=?", new String[] {Long.toString(article.id)}); } private  DataSource(Context context); @VisibleForTesting  DataSource(DatabaseSQLiteHelper helper); @VisibleForTesting  DataSource(SQLiteDatabase database); static DataSource get(Context context); synchronized void open(); boolean isOpen(); synchronized void close(); @VisibleForTesting SQLiteDatabase getDatabase(); void clearTables(); void beginTransaction(); void execSql(String sql); Cursor rawQuery(String sql); void setTransactionSuccessful(); void endTransaction(); long insertArticle(Article article); int updateSavedArticleState(Article article); int updateArticleInsertedAtTimestamp(Article article); void updateArticleContent(Article article); Article getArticle(String url); Cursor getAllArticles(); Cursor getSavedArticles(); Cursor getArticlesForSource(long remoteSourceId); void deleteArticle(Article article); void deleteArticle(long articleId); long insertCategory(String categoryName); void insertSource(Source source); void deleteSource(String name); List<Source> getSources(); Source getSource(long remoteId); CategoryCounts getCategoryCounts(long timestamp);  }