use of com.celements.blog.article.ArticleLoadParameter.DateMode in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_archived_future_noEditRights.
@Test
public void testGetDateRestrictions_archived_future_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.ARCHIVED, DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertEquals(getArchivedQuery(date), ret.getQueryString());
}
use of com.celements.blog.article.ArticleLoadParameter.DateMode in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_published_archived_noEditRights.
@Test
public void testGetDateRestrictions_published_archived_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED, DateMode.ARCHIVED));
Date date = new Date();
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
String expectedQuery = "(" + getPublishedQuery(date) + " OR " + getArchivedQuery(date) + ")";
assertEquals(expectedQuery, ret.getQueryString());
}
use of com.celements.blog.article.ArticleLoadParameter.DateMode in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_future_noEditRights.
@Test
public void testGetDateRestrictions_future_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertNull(ret);
}
use of com.celements.blog.article.ArticleLoadParameter.DateMode in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_published_archived.
@Test
public void testGetDateRestrictions_published_archived() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED, DateMode.ARCHIVED));
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
String expectedQuery = "(" + getPublishedQuery(date) + " OR " + getArchivedQuery(date) + ")";
assertEquals(expectedQuery, ret.getQueryString());
}
use of com.celements.blog.article.ArticleLoadParameter.DateMode in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_future.
@Test
public void testGetDateRestrictions_future() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertEquals(getFutureQuery(date), ret.getQueryString());
}
Aggregations