/
DownloadTest.java
34 lines (26 loc) · 1006 Bytes
/
DownloadTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.aemlab.junit.core.models;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.sling.api.resource.Resource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
@ExtendWith(AemContextExtension.class)
class DownloadTest {
private final AemContext context = new AemContext();
@BeforeEach
public void setup() throws Exception {
context.load().json(DownloadTest.class.getResourceAsStream("DownloadTest.json"),
JunitAppConstants.TEST_PAGE_ROOT);
}
@Test
void testDownload() {
Resource r = context.resourceResolver().getResource(JunitAppConstants.TEST_CONTENT_ROOT + "/download");
assertNotNull(r);
Download download = r.adaptTo(Download.class);
assertNotNull(download.getHref());
assertNotNull(download.getLabel());
assertNotNull(download.getTitle());
}
}