/* Condition 1a: String (match) */
{
/* Categories */
ISearchField field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "ple");
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1, news2, news3);
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "ows");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news2, news3);
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "d?t");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news3);
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "p*le");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1, news2, news3);
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "che lucene");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news5);
/* Source Name */
field = fFactory.createSearchField(INews.SOURCE, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "News 5");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news5);
/* Labels */
field = fFactory.createSearchField(INews.LABEL, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "rk");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1);
}
/* Condition 1b: String (no match) */
{
/* Author */
ISearchField field = fFactory.createSearchField(INews.AUTHOR, fNewsEntityName);
ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "ero Benj");
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
/* Categories */
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "ple slash");
result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "eshdot");
result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
field = fFactory.createSearchField(INews.CATEGORIES, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "che java");
result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
/* Source Name */
field = fFactory.createSearchField(INews.SOURCE, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "News 4");
result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
/* Labels */
field = fFactory.createSearchField(INews.LABEL, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "wo");
result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
}
/* Condition 2a: Link (match) */
{
/* News Link */
ISearchField field = fFactory.createSearchField(INews.LINK, fNewsEntityName);
ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "news.com/news1.html");
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1);
field = fFactory.createSearchField(INews.LINK, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "news.com/news?.html");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1, news2, news3, news4, news5);
field = fFactory.createSearchField(INews.LINK, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "/www.news.com/news1.*");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1);
/* Source Link */
field = fFactory.createSearchField(INews.SOURCE, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "source.com");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news4);
/* Feed Link */
field = fFactory.createSearchField(INews.FEED, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "feed.com/feed.xml");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1, news2, news3, news4, news5);
field = fFactory.createSearchField(INews.FEED, fNewsEntityName);
condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "feed.com?feed.xml");
result = fModelSearch.searchNews(list(condition), false);
assertSame(result, news1, news2, news3, news4, news5);
}
/* Condition 2b: Link (no match) */
{
/* News Link */
ISearchField field = fFactory.createSearchField(INews.LINK, fNewsEntityName);
ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.ENDS_WITH, "news.com/news6.ht,ö");
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
assertEquals(0, result.size());
field = fFactory.createSearchField(INews.LINK, fNewsEntityName);