use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testOrderByModificationDate.
@Test
public void testOrderByModificationDate() throws Exception {
Resource resource = context.currentResource("/content/list/listTypes/staticOrderByModificationDateListType");
slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
List list = context.request().adaptTo(List.class);
checkListConsistency(list, new String[] { "Page 2", "Page 1" });
}
use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testTagsListType.
@Test
public void testTagsListType() throws Exception {
Resource resource = context.currentResource("/content/list/listTypes/tagsListType");
slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
List list = context.request().adaptTo(List.class);
assertEquals(1, list.getItems().size());
}
use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testSearchListType.
@Test
public void testSearchListType() throws Exception {
SearchResult searchResult = mock(SearchResult.class);
Hit hit = mock(Hit.class);
when(mockSimpleSearch.getResult()).thenReturn(searchResult);
when(searchResult.getHits()).thenReturn(Collections.singletonList(hit));
Resource contentResource = context.currentResource("/content/list/pages/page_1/jcr:content");
when(hit.getResource()).thenReturn(contentResource);
Resource resource = context.currentResource("/content/list/listTypes/searchListType");
slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
List list = context.request().adaptTo(List.class);
assertEquals(1, list.getItems().size());
}
use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testOrderByModificationDateDesc.
@Test
public void testOrderByModificationDateDesc() throws Exception {
Resource resource = context.currentResource("/content/list/listTypes/staticOrderByModificationDateDescListType");
slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
List list = context.request().adaptTo(List.class);
checkListConsistency(list, new String[] { "Page 1", "Page 2" });
}
use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testStaticListType.
@Test
public void testStaticListType() {
Resource resource = context.currentResource("/content/list/listTypes/staticListType");
slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
List list = context.request().adaptTo(List.class);
assertEquals(2, list.getItems().size());
}
Aggregations