@Test public void fillFromCursor() { MatrixCursor cursor = new MatrixCursor(new String[]{ "_id", "alias", "url", "title", "description", "image", "content", "author", "source", "domain", "duration", "inserted_at", "is_article", "saved", "source_id", "name", "image_url" }); cursor.addRow(new Object[]{ 1L, "alias", "http: "test title", "test description", "image url", "<p>test paragraph</p>", "jake klinker", "google.com", "google.com", 1, 2, 1, 0, 2L, "test source name", "test source image url" }); cursor.moveToFirst(); Article article = new Article(cursor); assertEquals(1L, article.id); assertEquals("alias", article.alias); assertEquals("http: assertEquals("test title", article.title); assertEquals("test description", article.description); assertEquals("image url", article.image); assertEquals("<p>test paragraph</p>", article.content); assertEquals("jake klinker", article.author); assertEquals("google.com", article.source); assertEquals("google.com", article.domain); assertEquals(1, article.duration); assertEquals(2, article.insertedAt); assertTrue(article.isArticle); assertFalse(article.saved); assertEquals(2L, (long) article.sourceId); assertEquals("test source name", article.sourceModelName); assertEquals("test source image url", article.sourceModelImageUrl); }
@Override public void fillFromCursor(Cursor cursor) { for (int i = 0; i < cursor.getColumnCount(); i++) { String column = cursor.getColumnName(i); if (column.equals(ArticleModel.COLUMN_ID)) { this.id = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_ALIAS)) { this.alias = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_URL)) { this.url = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_TITLE)) { this.title = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DESCRIPTION)) { this.description = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_IMAGE)) { this.image = cursor.getString(i); } else if (column.equals(ContentModel.COLUMN_CONTENT)) { this.content = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_AUTHOR)) { this.author = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_SOURCE)) { this.source = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DOMAIN)) { this.domain = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DURATION)) { this.duration = cursor.getInt(i); } else if (column.equals(ArticleModel.COLUMN_INSERTED_AT)) { this.insertedAt = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_IS_ARTICLE)) { this.isArticle = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SAVED)) { this.saved = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SOURCE_ID)) { this.sourceId = cursor.getLong(i); } else if (column.equals(SourceModel.COLUMN_NAME)) { this.sourceModelName = cursor.getString(i); } else if (column.equals(SourceModel.COLUMN_IMAGE_URL)) { this.sourceModelImageUrl = cursor.getString(i); } } }
Article implements DatabaseModel { @Override public void fillFromCursor(Cursor cursor) { for (int i = 0; i < cursor.getColumnCount(); i++) { String column = cursor.getColumnName(i); if (column.equals(ArticleModel.COLUMN_ID)) { this.id = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_ALIAS)) { this.alias = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_URL)) { this.url = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_TITLE)) { this.title = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DESCRIPTION)) { this.description = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_IMAGE)) { this.image = cursor.getString(i); } else if (column.equals(ContentModel.COLUMN_CONTENT)) { this.content = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_AUTHOR)) { this.author = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_SOURCE)) { this.source = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DOMAIN)) { this.domain = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DURATION)) { this.duration = cursor.getInt(i); } else if (column.equals(ArticleModel.COLUMN_INSERTED_AT)) { this.insertedAt = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_IS_ARTICLE)) { this.isArticle = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SAVED)) { this.saved = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SOURCE_ID)) { this.sourceId = cursor.getLong(i); } else if (column.equals(SourceModel.COLUMN_NAME)) { this.sourceModelName = cursor.getString(i); } else if (column.equals(SourceModel.COLUMN_IMAGE_URL)) { this.sourceModelImageUrl = cursor.getString(i); } } } }
Article implements DatabaseModel { @Override public void fillFromCursor(Cursor cursor) { for (int i = 0; i < cursor.getColumnCount(); i++) { String column = cursor.getColumnName(i); if (column.equals(ArticleModel.COLUMN_ID)) { this.id = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_ALIAS)) { this.alias = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_URL)) { this.url = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_TITLE)) { this.title = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DESCRIPTION)) { this.description = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_IMAGE)) { this.image = cursor.getString(i); } else if (column.equals(ContentModel.COLUMN_CONTENT)) { this.content = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_AUTHOR)) { this.author = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_SOURCE)) { this.source = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DOMAIN)) { this.domain = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DURATION)) { this.duration = cursor.getInt(i); } else if (column.equals(ArticleModel.COLUMN_INSERTED_AT)) { this.insertedAt = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_IS_ARTICLE)) { this.isArticle = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SAVED)) { this.saved = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SOURCE_ID)) { this.sourceId = cursor.getLong(i); } else if (column.equals(SourceModel.COLUMN_NAME)) { this.sourceModelName = cursor.getString(i); } else if (column.equals(SourceModel.COLUMN_IMAGE_URL)) { this.sourceModelImageUrl = cursor.getString(i); } } } Article();  Article(Cursor cursor);  Article(Intent intent); }
Article implements DatabaseModel { @Override public void fillFromCursor(Cursor cursor) { for (int i = 0; i < cursor.getColumnCount(); i++) { String column = cursor.getColumnName(i); if (column.equals(ArticleModel.COLUMN_ID)) { this.id = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_ALIAS)) { this.alias = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_URL)) { this.url = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_TITLE)) { this.title = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DESCRIPTION)) { this.description = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_IMAGE)) { this.image = cursor.getString(i); } else if (column.equals(ContentModel.COLUMN_CONTENT)) { this.content = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_AUTHOR)) { this.author = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_SOURCE)) { this.source = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DOMAIN)) { this.domain = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DURATION)) { this.duration = cursor.getInt(i); } else if (column.equals(ArticleModel.COLUMN_INSERTED_AT)) { this.insertedAt = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_IS_ARTICLE)) { this.isArticle = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SAVED)) { this.saved = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SOURCE_ID)) { this.sourceId = cursor.getLong(i); } else if (column.equals(SourceModel.COLUMN_NAME)) { this.sourceModelName = cursor.getString(i); } else if (column.equals(SourceModel.COLUMN_IMAGE_URL)) { this.sourceModelImageUrl = cursor.getString(i); } } } Article();  Article(Cursor cursor);  Article(Intent intent); @Override void fillFromCursor(Cursor cursor); void fillFromIntent(Intent intent); void putIntoIntent(Intent intent); }
Article implements DatabaseModel { @Override public void fillFromCursor(Cursor cursor) { for (int i = 0; i < cursor.getColumnCount(); i++) { String column = cursor.getColumnName(i); if (column.equals(ArticleModel.COLUMN_ID)) { this.id = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_ALIAS)) { this.alias = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_URL)) { this.url = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_TITLE)) { this.title = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DESCRIPTION)) { this.description = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_IMAGE)) { this.image = cursor.getString(i); } else if (column.equals(ContentModel.COLUMN_CONTENT)) { this.content = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_AUTHOR)) { this.author = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_SOURCE)) { this.source = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DOMAIN)) { this.domain = cursor.getString(i); } else if (column.equals(ArticleModel.COLUMN_DURATION)) { this.duration = cursor.getInt(i); } else if (column.equals(ArticleModel.COLUMN_INSERTED_AT)) { this.insertedAt = cursor.getLong(i); } else if (column.equals(ArticleModel.COLUMN_IS_ARTICLE)) { this.isArticle = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SAVED)) { this.saved = cursor.getInt(i) == 1; } else if (column.equals(ArticleModel.COLUMN_SOURCE_ID)) { this.sourceId = cursor.getLong(i); } else if (column.equals(SourceModel.COLUMN_NAME)) { this.sourceModelName = cursor.getString(i); } else if (column.equals(SourceModel.COLUMN_IMAGE_URL)) { this.sourceModelImageUrl = cursor.getString(i); } } } Article();  Article(Cursor cursor);  Article(Intent intent); @Override void fillFromCursor(Cursor cursor); void fillFromIntent(Intent intent); void putIntoIntent(Intent intent); public long id; public String alias; public String url; public String title; public String description; public String image; public String content; public String author; public String source; public String domain; public int duration; public long insertedAt; public boolean isArticle; public boolean saved; public Long sourceId; public String sourceModelName; public String sourceModelImageUrl; }