use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class FeedItemTest method testShownotes.
/**
* Checks if the shownotes equal TEXT_LONG, using the given `description` and `content:encoded`.
*
* @param description Description of the feed item
* @param contentEncoded `content:encoded` of the feed item
*/
private void testShownotes(String description, String contentEncoded) {
FeedItem item = new FeedItem();
item.setDescriptionIfLonger(description);
item.setDescriptionIfLonger(contentEncoded);
assertEquals(TEXT_LONG, item.getDescription());
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class FeedMediaTest method testDownloadMediaOfPlayedItem_unchangedItemState.
/**
* Downloading a media from a played item (thus not new) should not change the item state.
*/
@Test
public void testDownloadMediaOfPlayedItem_unchangedItemState() {
FeedItem item = mock(FeedItem.class);
when(item.isNew()).thenReturn(false);
when(item.isPlayed()).thenReturn(true);
media.setItem(item);
media.setDownloaded(true);
verify(item, never()).setNew();
verify(item, never()).setPlayed(true);
verify(item, never()).setPlayed(false);
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class RemoteMedia method equals.
@Override
public boolean equals(Object other) {
if (other instanceof RemoteMedia) {
RemoteMedia rm = (RemoteMedia) other;
return TextUtils.equals(downloadUrl, rm.downloadUrl) && TextUtils.equals(feedUrl, rm.feedUrl) && TextUtils.equals(itemIdentifier, rm.itemIdentifier);
}
if (other instanceof FeedMedia) {
FeedMedia fm = (FeedMedia) other;
if (!TextUtils.equals(downloadUrl, fm.getStreamUrl())) {
return false;
}
FeedItem fi = fm.getItem();
if (fi == null || !TextUtils.equals(itemIdentifier, fi.getItemIdentifier())) {
return false;
}
Feed feed = fi.getFeed();
return feed != null && TextUtils.equals(feedUrl, feed.getDownload_url());
}
return false;
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class FeedItemUtilTest method testGetIds.
// Test the getIds() method
@Test
public void testGetIds() {
List<FeedItem> feedItemsList = new ArrayList<FeedItem>(5);
List<Integer> idList = new ArrayList<Integer>();
idList.add(980);
idList.add(324);
idList.add(226);
idList.add(164);
idList.add(854);
for (int i = 0; i < 5; i++) {
FeedItem item = createFeedItem(feedLink, itemLink);
item.setId(idList.get(i));
feedItemsList.add(item);
}
long[] actual = FeedItemUtil.getIds(feedItemsList);
// covers edge case for getIds() method
List<FeedItem> emptyList = new ArrayList<FeedItem>();
long[] testEmptyList = FeedItemUtil.getIds(emptyList);
assertEquals(msg, 0, testEmptyList.length);
assertEquals(msg, 980, actual[0]);
assertEquals(msg, 324, actual[1]);
assertEquals(msg, 226, actual[2]);
assertEquals(msg, 164, actual[3]);
assertEquals(msg, 854, actual[4]);
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class FeedItemUtilTest method createFeedItem.
private static FeedItem createFeedItem(String feedLink, String itemLink) {
Feed feed = new Feed();
feed.setLink(feedLink);
FeedItem feedItem = new FeedItem();
feedItem.setLink(itemLink);
feedItem.setFeed(feed);
feed.setItems(Collections.singletonList(feedItem));
return feedItem;
}
Aggregations