use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContentFragmentImplTest method textOnlySingleElement.
@Test
void textOnlySingleElement() {
ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY_SINGLE_ELEMENT);
assertContentFragment(fragment, TITLE, DESCRIPTION, TEXT_ONLY_TYPE, TEXT_ONLY_NAME, ASSOCIATED_CONTENT, SECOND_TEXT_ONLY);
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_TEXT_ONLY_SINGLE_ELEMENT));
}
use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContentFragmentImplTest method structuredSingleElementMain.
@Test
void structuredSingleElementMain() {
when(fragmentRenderService.render(any(Resource.class))).thenReturn(MAIN_CONTENT);
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_SINGLE_ELEMENT_MAIN);
assertContentFragment(fragment, TITLE, DESCRIPTION, STRUCTURED_TYPE, STRUCTURED_NAME, ASSOCIATED_CONTENT, MAIN);
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_STRUCTURED_SINGLE_ELEMENT_MAIN));
}
use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContentFragmentImplTest method getElements.
@Test
void getElements() {
ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY);
final Map<String, DAMContentFragment.DAMContentElement> elements = fragment.getExportedElements();
assertNotNull(elements);
assertEquals(2, elements.size());
assertTrue(elements.containsKey("main"));
assertTrue(elements.containsKey("second"));
}
use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContentFragmentImplTest method getExportedType.
@Test
void getExportedType() {
ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY);
assertEquals(ContentFragmentImpl.RESOURCE_TYPE, fragment.getExportedType());
}
use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContentFragmentImplTest method structuredGetEditorJSON.
@Test
void structuredGetEditorJSON() {
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_MULTIPLE_ELEMENTS);
String expectedJSON = "{\"title\":\"Test Content Fragment\",\"path\":\"/content/dam/contentfragments/structured\"," + "\"elements\":[\"second\",\"non-existing\",\"main\"],\"associatedContent\":[{\"title\":\"Test Collection\"" + ",\"path\":\"/content/dam/collections/X/X7v6pJAcy5qtkUdXdIxR/test\"}]}";
assertEquals(fragment.getEditorJSON(), expectedJSON);
}
Aggregations