@Test public void insertCategory() { source.insertCategory("test"); verify(database).insert(eq("category"), eq((String) null), any(ContentValues.class)); verifyNoMoreInteractions(database); }
public long insertCategory(String categoryName) { ContentValues values = new ContentValues(1); values.put(CategoryModel.COLUMN_NAME, categoryName); return database.insert(CategoryModel.TABLE, null, values); }
DataSource { public long insertCategory(String categoryName) { ContentValues values = new ContentValues(1); values.put(CategoryModel.COLUMN_NAME, categoryName); return database.insert(CategoryModel.TABLE, null, values); } }
DataSource { public long insertCategory(String categoryName) { ContentValues values = new ContentValues(1); values.put(CategoryModel.COLUMN_NAME, categoryName); return database.insert(CategoryModel.TABLE, null, values); } private  DataSource(Context context); @VisibleForTesting  DataSource(DatabaseSQLiteHelper helper); @VisibleForTesting  DataSource(SQLiteDatabase database); }
DataSource { public long insertCategory(String categoryName) { ContentValues values = new ContentValues(1); values.put(CategoryModel.COLUMN_NAME, categoryName); return database.insert(CategoryModel.TABLE, null, values); } 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 long insertCategory(String categoryName) { ContentValues values = new ContentValues(1); values.put(CategoryModel.COLUMN_NAME, categoryName); return database.insert(CategoryModel.TABLE, null, values); } 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);  }