@Test public void testPopulate() { item.populate(new TestItem() { @Override public String getTitle() { return "title"; } @Override public String getRawType() { return "rawType"; } @Override public String getRawUrl() { return "rawUrl"; } @Override public long[] getKids() { return new long[]{1l}; } @Override public String getBy() { return "by"; } @Override public long getTime() { return 1234l; } @Override public String getText() { return "text"; } @Override public String getParent() { return "1"; } @Override public boolean isDead() { return true; } @Override public boolean isDeleted() { return true; } @Override public int getDescendants() { return 1; } @Override public int getScore() { return 5; } }); assertEquals("title", item.getTitle()); assertEquals("text", item.getText()); assertEquals("rawType", item.getRawType()); assertEquals("rawUrl", item.getRawUrl()); assertEquals("by", item.getBy()); assertEquals(1234l, item.getTime()); assertEquals(1, item.getDescendants()); assertEquals(1, item.getLastKidCount()); assertEquals(5, item.getScore()); assertTrue(item.isDead()); assertTrue(item.isDeleted()); assertThat(item.getDisplayedAuthor(RuntimeEnvironment.application, true, 0)) .contains(" - by"); assertThat(item.getDisplayedTime(RuntimeEnvironment.application)) .isNotEmpty(); assertThat(item.getKids()).hasSize(1); assertEquals(1, item.getKidItems()[0].getLevel()); }
@Override public void populate(Item info) { title = info.getTitle(); time = info.getTime(); by = info.getBy(); kids = info.getKids(); url = info.getRawUrl(); text = info.getText(); displayedText = info.getDisplayedText(); type = info.getRawType(); descendants = info.getDescendants(); hasNewDescendants = lastKidCount >= 0 && descendants > lastKidCount; lastKidCount = descendants; parent = Long.parseLong(info.getParent()); deleted = info.isDeleted(); dead = info.isDead(); score = info.getScore(); viewed = info.isViewed(); favorite = info.isFavorite(); localRevision = 1; }
HackerNewsItem implements Item { @Override public void populate(Item info) { title = info.getTitle(); time = info.getTime(); by = info.getBy(); kids = info.getKids(); url = info.getRawUrl(); text = info.getText(); displayedText = info.getDisplayedText(); type = info.getRawType(); descendants = info.getDescendants(); hasNewDescendants = lastKidCount >= 0 && descendants > lastKidCount; lastKidCount = descendants; parent = Long.parseLong(info.getParent()); deleted = info.isDeleted(); dead = info.isDead(); score = info.getScore(); viewed = info.isViewed(); favorite = info.isFavorite(); localRevision = 1; } }
HackerNewsItem implements Item { @Override public void populate(Item info) { title = info.getTitle(); time = info.getTime(); by = info.getBy(); kids = info.getKids(); url = info.getRawUrl(); text = info.getText(); displayedText = info.getDisplayedText(); type = info.getRawType(); descendants = info.getDescendants(); hasNewDescendants = lastKidCount >= 0 && descendants > lastKidCount; lastKidCount = descendants; parent = Long.parseLong(info.getParent()); deleted = info.isDeleted(); dead = info.isDead(); score = info.getScore(); viewed = info.isViewed(); favorite = info.isFavorite(); localRevision = 1; } HackerNewsItem(long id); private  HackerNewsItem(long id, int level); @Synthetic  HackerNewsItem(Parcel source); }
HackerNewsItem implements Item { @Override public void populate(Item info) { title = info.getTitle(); time = info.getTime(); by = info.getBy(); kids = info.getKids(); url = info.getRawUrl(); text = info.getText(); displayedText = info.getDisplayedText(); type = info.getRawType(); descendants = info.getDescendants(); hasNewDescendants = lastKidCount >= 0 && descendants > lastKidCount; lastKidCount = descendants; parent = Long.parseLong(info.getParent()); deleted = info.isDeleted(); dead = info.isDead(); score = info.getScore(); viewed = info.isViewed(); favorite = info.isFavorite(); localRevision = 1; } HackerNewsItem(long id); private  HackerNewsItem(long id, int level); @Synthetic  HackerNewsItem(Parcel source); @Override void populate(Item info); @Override String getRawType(); @Override String getRawUrl(); @Override long[] getKids(); @Override String getBy(); @Override long getTime(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override String getId(); @Override long getLongId(); @Override String getTitle(); @Override String getDisplayedTitle(); @NonNull @Override String getType(); @Override Spannable getDisplayedAuthor(Context context, boolean linkify, int color); @Override Spannable getDisplayedTime(Context context); @Override int getKidCount(); @Override int getLastKidCount(); @Override void setLastKidCount(int lastKidCount); @Override boolean hasNewKids(); @Override String getUrl(); @Override String getSource(); @Override HackerNewsItem[] getKidItems(); @Override String getText(); @Override CharSequence getDisplayedText(); @Override boolean isStoryType(); @Override boolean isFavorite(); @Override void setFavorite(boolean favorite); @Override int getLocalRevision(); @Override void setLocalRevision(int localRevision); @Override int getDescendants(); @Override boolean isViewed(); @Override void setIsViewed(boolean isViewed); @Override int getLevel(); @Override String getParent(); @Override Item getParentItem(); @Override boolean isDeleted(); @Override boolean isDead(); @Override int getScore(); @Override void incrementScore(); @Override boolean isVoted(); @Override boolean isPendingVoted(); @Override void clearPendingVoted(); @Override boolean isCollapsed(); @Override void setCollapsed(boolean collapsed); @Override int getRank(); @Override boolean isContentExpanded(); @Override void setContentExpanded(boolean expanded); @Override long getNeighbour(int direction); @Override int hashCode(); @Override boolean equals(Object o); }
HackerNewsItem implements Item { @Override public void populate(Item info) { title = info.getTitle(); time = info.getTime(); by = info.getBy(); kids = info.getKids(); url = info.getRawUrl(); text = info.getText(); displayedText = info.getDisplayedText(); type = info.getRawType(); descendants = info.getDescendants(); hasNewDescendants = lastKidCount >= 0 && descendants > lastKidCount; lastKidCount = descendants; parent = Long.parseLong(info.getParent()); deleted = info.isDeleted(); dead = info.isDead(); score = info.getScore(); viewed = info.isViewed(); favorite = info.isFavorite(); localRevision = 1; } HackerNewsItem(long id); private  HackerNewsItem(long id, int level); @Synthetic  HackerNewsItem(Parcel source); @Override void populate(Item info); @Override String getRawType(); @Override String getRawUrl(); @Override long[] getKids(); @Override String getBy(); @Override long getTime(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override String getId(); @Override long getLongId(); @Override String getTitle(); @Override String getDisplayedTitle(); @NonNull @Override String getType(); @Override Spannable getDisplayedAuthor(Context context, boolean linkify, int color); @Override Spannable getDisplayedTime(Context context); @Override int getKidCount(); @Override int getLastKidCount(); @Override void setLastKidCount(int lastKidCount); @Override boolean hasNewKids(); @Override String getUrl(); @Override String getSource(); @Override HackerNewsItem[] getKidItems(); @Override String getText(); @Override CharSequence getDisplayedText(); @Override boolean isStoryType(); @Override boolean isFavorite(); @Override void setFavorite(boolean favorite); @Override int getLocalRevision(); @Override void setLocalRevision(int localRevision); @Override int getDescendants(); @Override boolean isViewed(); @Override void setIsViewed(boolean isViewed); @Override int getLevel(); @Override String getParent(); @Override Item getParentItem(); @Override boolean isDeleted(); @Override boolean isDead(); @Override int getScore(); @Override void incrementScore(); @Override boolean isVoted(); @Override boolean isPendingVoted(); @Override void clearPendingVoted(); @Override boolean isCollapsed(); @Override void setCollapsed(boolean collapsed); @Override int getRank(); @Override boolean isContentExpanded(); @Override void setContentExpanded(boolean expanded); @Override long getNeighbour(int direction); @Override int hashCode(); @Override boolean equals(Object o); static final Creator<HackerNewsItem> CREATOR; }