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 structuredNonExistingVariation.
@Test
void structuredNonExistingVariation() {
when(fragmentRenderService.render(any(Resource.class))).thenReturn(MAIN_CONTENT);
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_NON_EXISTING_VARIATION);
assertContentFragment(fragment, TITLE, DESCRIPTION, STRUCTURED_TYPE, STRUCTURED_NAME, ASSOCIATED_CONTENT, MAIN, SECOND_STRUCTURED);
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_STRUCTURED_NON_EXISTING_VARIATION));
}
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 structuredNoPath.
@Test
void structuredNoPath() {
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_NO_PATH);
assertNotNull(fragment, "Model shouldn't be null when no path is set");
}
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 structuredNestedModel.
@Test
void structuredNestedModel() {
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_NESTED_MODEL);
assertContentFragment(fragment, TITLE, DESCRIPTION, STRUCTURED_TYPE_NESTED, STRUCTURED_NESTED_NAME, ASSOCIATED_CONTENT, MAIN, SECOND_STRUCTURED);
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_STRUCTURED_NESTED_MODEL));
}
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 getParagraphOfSingleTextDisplayMode.
@Test
void getParagraphOfSingleTextDisplayMode() {
when(fragmentRenderService.render(any(Resource.class))).thenReturn(MAIN_CONTENT);
ContentFragment contentFragment = getModelInstanceUnderTest(CF_STRUCTURED_SINGLE_ELEMENT_MAIN);
assertArrayEquals(new String[] { MAIN_CONTENT }, contentFragment.getParagraphs());
}
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 structuredWithVariationGetEditorJSON.
@Test
void structuredWithVariationGetEditorJSON() {
ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_VARIATION);
String expectedJSON = "{\"title\":\"Test Content Fragment\",\"path\":\"/content/dam/contentfragments/structured\"," + "\"variation\":\"teaser\",\"associatedContent\":[{\"title\":\"Test Collection\"" + ",\"path\":\"/content/dam/collections/X/X7v6pJAcy5qtkUdXdIxR/test\"}]}";
assertEquals(fragment.getEditorJSON(), expectedJSON);
}
Aggregations