Search in sources :

Example 1 with Download

use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class DownloadImplTest method testDownloadWithDamProperties.

@Test
void testDownloadWithDamProperties() {
    Download download = getDownloadUnderTest(DOWNLOAD_2);
    assertEquals(DAM_TITLE, download.getTitle());
    assertEquals(DAM_DESCRIPTION, download.getDescription());
    assertEquals(CONTEXT_PATH + PDF_ASSET_DOWNLOAD_PATH, download.getUrl());
    assertEquals(PDF_FILENAME, download.getFilename());
    assertEquals(PDF_EXTENSION, download.getExtension());
    assertEquals(PDF_FILESIZE_STRING, download.getSize());
    assertEquals(PDF_FORMAT_STRING, download.getFormat());
    Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_WITH_DAM_PROPERTIES));
}
Also used : Download(com.adobe.cq.wcm.core.components.models.Download) Test(org.junit.jupiter.api.Test)

Example 2 with Download

use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class DownloadImplTest method testFullyConfiguredDownload.

@Test
void testFullyConfiguredDownload() {
    Download download = getDownloadUnderTest(DOWNLOAD_1);
    assertEquals(TITLE, download.getTitle());
    assertEquals(DESCRIPTION, download.getDescription());
    assertEquals(CONTEXT_PATH + PDF_ASSET_DOWNLOAD_PATH, download.getUrl());
    assertEquals(PDF_FILENAME, download.getFilename());
    assertEquals(PDF_EXTENSION, download.getExtension());
    assertEquals(PDF_FILESIZE_STRING, download.getSize());
    assertEquals(PDF_FORMAT_STRING, download.getFormat());
    assertEquals(COMPONENT_ACTION_TEXT, download.getActionText());
    Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
Also used : Download(com.adobe.cq.wcm.core.components.models.Download) Test(org.junit.jupiter.api.Test)

Example 3 with Download

use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class DownloadImplTest method testDownloadWithoutActionText.

@Test
void testDownloadWithoutActionText() {
    Download downloadWithoutActionText = getDownloadUnderTest(DOWNLOAD_2);
    assertNull(downloadWithoutActionText.getActionText(), "Expected action text is not correct");
    Utils.testJSONExport(downloadWithoutActionText, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_WITHOUT_ACTION_TEXT));
}
Also used : Download(com.adobe.cq.wcm.core.components.models.Download) Test(org.junit.jupiter.api.Test)

Example 4 with Download

use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class DownloadImplTest method testDownloadWithTitleType.

@Test
void testDownloadWithTitleType() {
    Download download = getDownloadUnderTest(DOWNLOAD_1, Download.PN_TITLE_TYPE, "h5");
    assertEquals("h5", download.getTitleType(), "Expected title type is not correct");
    Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_WITH_TITLE_TYPE));
}
Also used : Download(com.adobe.cq.wcm.core.components.models.Download) Test(org.junit.jupiter.api.Test)

Example 5 with Download

use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class DownloadImplTest method testFullyConfiguredFileDownload.

@Test
void testFullyConfiguredFileDownload() {
    Download download = getDownloadUnderTest(DOWNLOAD_3);
    assertEquals(TITLE, download.getTitle());
    assertEquals(DESCRIPTION, download.getDescription());
    assertEquals(CONTEXT_PATH + PDF_FILE_DOWNLOAD_PATH, download.getUrl());
    assertEquals(PDF_FILENAME, download.getFilename());
    assertEquals(PDF_EXTENSION, download.getExtension());
    assertEquals(PDF_FORMAT_STRING, download.getFormat());
    assertEquals(COMPONENT_ACTION_TEXT, download.getActionText());
    Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED_FILE));
}
Also used : Download(com.adobe.cq.wcm.core.components.models.Download) Test(org.junit.jupiter.api.Test)

Aggregations

Download (com.adobe.cq.wcm.core.components.models.Download)10 Test (org.junit.jupiter.api.Test)10 MockStyle (com.adobe.cq.wcm.core.components.testing.MockStyle)2 Style (com.day.cq.wcm.api.designer.Style)2 Resource (org.apache.sling.api.resource.Resource)2 MockValueMap (org.apache.sling.testing.resourceresolver.MockValueMap)2