use of de.danoeh.antennapod.model.feed.FeedFilter in project AntennaPod by AntennaPod.
the class FeedFilterTest method testComplexExcludeFilter.
@Test
public void testComplexExcludeFilter() {
String excludeFilter = "Hello \"Two words\"";
FeedFilter filter = new FeedFilter("", excludeFilter);
FeedItem item = new FeedItem();
item.setTitle("hello world");
FeedItem item2 = new FeedItem();
item2.setTitle("One three words");
FeedItem item3 = new FeedItem();
item3.setTitle("One two words");
assertTrue(filter.excludeOnly());
assertFalse(filter.includeOnly());
assertEquals(excludeFilter, filter.getExcludeFilter());
assertEquals("", filter.getIncludeFilter());
assertFalse(filter.shouldAutoDownload(item));
assertTrue(filter.shouldAutoDownload(item2));
assertFalse(filter.shouldAutoDownload(item3));
}
use of de.danoeh.antennapod.model.feed.FeedFilter in project AntennaPod by AntennaPod.
the class FeedFilterTest method testMinimalDurationFilter.
@Test
public void testMinimalDurationFilter() {
FeedItem download = new FeedItem();
download.setTitle("Hello friend!");
FeedMedia downloadMedia = FeedMediaMother.anyFeedMedia();
downloadMedia.setDuration(Converter.durationStringShortToMs("05:00", false));
download.setMedia(downloadMedia);
// because duration of the media in unknown
FeedItem download2 = new FeedItem();
download2.setTitle("Hello friend!");
FeedMedia unknownDurationMedia = FeedMediaMother.anyFeedMedia();
download2.setMedia(unknownDurationMedia);
// because it is not long enough
FeedItem doNotDownload = new FeedItem();
doNotDownload.setTitle("Hello friend!");
FeedMedia doNotDownloadMedia = FeedMediaMother.anyFeedMedia();
doNotDownloadMedia.setDuration(Converter.durationStringShortToMs("02:00", false));
doNotDownload.setMedia(doNotDownloadMedia);
int minimalDurationFilter = 3 * 60;
FeedFilter filter = new FeedFilter("", "", minimalDurationFilter);
assertTrue(filter.hasMinimalDurationFilter());
assertTrue(filter.shouldAutoDownload(download));
assertFalse(filter.shouldAutoDownload(doNotDownload));
assertTrue(filter.shouldAutoDownload(download2));
}
use of de.danoeh.antennapod.model.feed.FeedFilter in project AntennaPod by AntennaPod.
the class FeedFilterTest method testNullFilter.
@Test
public void testNullFilter() {
FeedFilter filter = new FeedFilter();
FeedItem item = new FeedItem();
item.setTitle("Hello world");
assertFalse(filter.excludeOnly());
assertFalse(filter.includeOnly());
assertEquals("", filter.getExcludeFilter());
assertEquals("", filter.getIncludeFilter());
assertTrue(filter.shouldAutoDownload(item));
}
Aggregations