use of com.adobe.cq.wcm.core.components.testing.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithDefaultTitleType.
@Test
void testDownloadWithDefaultTitleType() {
Resource mockResource = mock(Resource.class);
Style mockStyle = new MockStyle(mockResource, new MockValueMap(mockResource));
Download download = getDownloadUnderTest(DOWNLOAD_1, mockStyle);
assertNull(download.getTitleType(), "Expected title type is not correct");
Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
use of com.adobe.cq.wcm.core.components.testing.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class AllowedEmbeddablesDataSourceServletTest method testAllowedEmbeddablesDesignDataSourceServlet.
@Test
public void testAllowedEmbeddablesDesignDataSourceServlet() {
Designer designer = mock(Designer.class);
context.registerAdapter(ResourceResolver.class, Designer.class, (Function<ResourceResolver, Designer>) input -> designer);
Resource styleResource = context.resourceResolver().getResource("/apps/etc/designs/embed");
MockStyle mockStyle = new MockStyle(styleResource, styleResource.getValueMap());
when(designer.getStyle(any(Resource.class))).thenReturn(mockStyle);
context.request().setAttribute(Value.CONTENTPATH_ATTRIBUTE, CURRENT_PATH);
dataSourceServlet.doGet(context.request(), context.response());
DataSource dataSource = (DataSource) context.request().getAttribute(DataSource.class.getName());
assertNotNull(dataSource);
validateAllowedEmbeddables(dataSource, getExpectedAllowedEmbeddables(new String[][] { { "Select", "" }, { "Chatbot", "/apps/my-app/chatbot" }, { "Social", "/apps/my-app/social" } }));
}
use of com.adobe.cq.wcm.core.components.testing.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithHiddenTitleLink.
@Test
void testDownloadWithHiddenTitleLink() {
Resource mockResource = mock(Resource.class);
MockValueMap mockValueMap = new MockValueMap(mockResource);
mockValueMap.put(Download.PN_HIDE_TITLE_LINK, true);
Style mockStyle = new MockStyle(mockResource, mockValueMap);
Download download = getDownloadUnderTest(DOWNLOAD_1, mockStyle);
assertTrue(download.hideTitleLink(), "Expected title link to be hidden");
}
Aggregations