@Test public void getSavedArticles() { when(database.query( anyString(), eq((String[]) null), eq("saved=1"), eq((String[]) null), eq((String) null), eq((String) null), eq("inserted_at desc"))) .thenReturn(cursor); assertEquals(cursor, source.getSavedArticles()); }
public Cursor getSavedArticles() { return database.query( ArticleModel.TABLE + " a left outer join " + SourceModel.TABLE + " s " + "on a." + ArticleModel.COLUMN_SOURCE_ID + " = s." + SourceModel.COLUMN_REMOTE_ID, null, ArticleModel.COLUMN_SAVED + "=1", null, null, null, ArticleModel.COLUMN_INSERTED_AT + " desc"); }
DataSource { public Cursor getSavedArticles() { return database.query( ArticleModel.TABLE + " a left outer join " + SourceModel.TABLE + " s " + "on a." + ArticleModel.COLUMN_SOURCE_ID + " = s." + SourceModel.COLUMN_REMOTE_ID, null, ArticleModel.COLUMN_SAVED + "=1", null, null, null, ArticleModel.COLUMN_INSERTED_AT + " desc"); } }
DataSource { public Cursor getSavedArticles() { return database.query( ArticleModel.TABLE + " a left outer join " + SourceModel.TABLE + " s " + "on a." + ArticleModel.COLUMN_SOURCE_ID + " = s." + SourceModel.COLUMN_REMOTE_ID, null, ArticleModel.COLUMN_SAVED + "=1", null, null, null, ArticleModel.COLUMN_INSERTED_AT + " desc"); } private  DataSource(Context context); @VisibleForTesting  DataSource(DatabaseSQLiteHelper helper); @VisibleForTesting  DataSource(SQLiteDatabase database); }
DataSource { public Cursor getSavedArticles() { return database.query( ArticleModel.TABLE + " a left outer join " + SourceModel.TABLE + " s " + "on a." + ArticleModel.COLUMN_SOURCE_ID + " = s." + SourceModel.COLUMN_REMOTE_ID, null, ArticleModel.COLUMN_SAVED + "=1", null, null, null, ArticleModel.COLUMN_INSERTED_AT + " desc"); } 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 Cursor getSavedArticles() { return database.query( ArticleModel.TABLE + " a left outer join " + SourceModel.TABLE + " s " + "on a." + ArticleModel.COLUMN_SOURCE_ID + " = s." + SourceModel.COLUMN_REMOTE_ID, null, ArticleModel.COLUMN_SAVED + "=1", null, null, null, ArticleModel.COLUMN_INSERTED_AT + " desc"); } 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);  }