use of org.nzbhydra.indexers.Newznab in project nzbhydra2 by theotherp.
the class DuplicateDetectorTest method setValues.
protected void setValues(SearchResultItem item, String indexerName, String poster, String group, Instant pubDate) {
item.setAgePrecise(true);
item.setTitle("title");
item.setIndexerGuid("123");
item.setPubDate(pubDate);
item.setPoster(poster);
item.setGroup(group);
item.setSize(10000L);
Newznab indexer = new Newznab();
IndexerConfig config = new IndexerConfig();
config.setName(indexerName);
IndexerEntity indexerEntity = new IndexerEntity();
indexerEntity.setName(indexerName);
indexer.initialize(config, indexerEntity);
item.setIndexer(indexer);
}
use of org.nzbhydra.indexers.Newznab in project nzbhydra2 by theotherp.
the class ResultAcceptorTest method shouldCheckForCategoryDisabledForIndexer.
@Test
public void shouldCheckForCategoryDisabledForIndexer() {
Indexer indexer = new Newznab();
indexer.initialize(indexerConfig, new IndexerEntity());
item.setIndexer(indexer);
// All categories enabled
when(indexerConfig.getEnabledCategories()).thenReturn(Collections.emptyList());
assertTrue(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
// Used category enabled
when(indexerConfig.getEnabledCategories()).thenReturn(Arrays.asList(category.getName()));
assertTrue(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
// Only other category enabled
when(indexerConfig.getEnabledCategories()).thenReturn(Arrays.asList("Other"));
assertFalse(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
}
Aggregations