ContentFragmentImpl implements ContentFragment { @NotNull @Override public String getEditorJSON() { return damContentFragment.getEditorJSON(); }  @Nullable @Override String getTitle(); @Nullable @Override String getDescription(); @Nullable @Override String getType(); @Nullable @Override String getName(); @NotNull @Override String getGridResourceType(); @NotNull @Override String getEditorJSON(); @NotNull @Override Map<String, DAMContentElement> getExportedElements(); @NotNull @Override String[] getExportedElementsOrder(); @Nullable @Override List<DAMContentElement> getElements(); @Nullable @Override List<Resource> getAssociatedContent(); @NotNull @Override String getExportedType(); @NotNull @Override Map<String, ? extends ComponentExporter> getExportedItems(); @NotNull @Override String[] getExportedItemsOrder(); @Nullable @Override String[] getParagraphs(); static final String RESOURCE_TYPE; }
@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); }
@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); }
@Test void textOnlyGetEditorJSON() { ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY_MULTIPLE_ELEMENTS); String expectedJSON = "{\"title\":\"Test Content Fragment\",\"path\":\"/content/dam/contentfragments/text-only\"" + ",\"elements\":[\"second\",\"non-existing\",\"main\"],\"associatedContent\":[{\"title\":\"Test Collection\"" + ",\"path\":\"/content/dam/collections/X/X7v6pJAcy5qtkUdXdIxR/test\"}]}"; assertEquals(fragment.getEditorJSON(), expectedJSON); }
@Test void textOnlyWithVariationGetEditorJSON() { ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY_VARIATION); String expectedJSON = "{\"title\":\"Test Content Fragment\",\"path\":\"/content/dam/contentfragments/text-only\"," + "\"variation\":\"teaser\",\"associatedContent\":[{\"title\":\"Test Collection\"" + ",\"path\":\"/content/dam/collections/X/X7v6pJAcy5qtkUdXdIxR/test\"}]}"; assertEquals(fragment.getEditorJSON(), expectedJSON); }