@Test
  public void testGetDDMXSD() throws Exception {
    String expectedXSD = read("test-ddm-structure-all-fields.xml");

    DDMForm expectedDDMForm = DDMFormXSDDeserializerUtil.deserialize(expectedXSD);

    String actualXSD =
        JournalConverterUtil.getDDMXSD(read("test-journal-structure-all-fields.xml"));

    validateDDMXSD(actualXSD);

    DDMForm actualDDMForm = DDMFormXSDDeserializerUtil.deserialize(actualXSD);

    assertEquals(expectedDDMForm, actualDDMForm);
  }
  @Test
  public void testArticleImages() throws Exception {
    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId());

    int initialArticleImagesCount =
        JournalArticleImageLocalServiceUtil.getArticleImagesCount(group.getGroupId());

    Class<?> clazz = getClass();

    ClassLoader classLoader = clazz.getClassLoader();

    String definition =
        StringUtil.read(
            classLoader,
            "com/liferay/journal/dependencies" + "/test-ddm-structure-image-field.xml");

    DDMForm ddmForm = DDMFormXSDDeserializerUtil.deserialize(definition);

    DDMStructure ddmStructure =
        DDMStructureTestUtil.addStructure(
            serviceContext.getScopeGroupId(), JournalArticle.class.getName(), ddmForm);

    DDMTemplate ddmTemplate =
        DDMTemplateTestUtil.addTemplate(
            serviceContext.getScopeGroupId(), ddmStructure.getStructureId());

    String content =
        StringUtil.read(
            classLoader,
            "com/liferay/journal/dependencies" + "/test-journal-content-image-field.xml");

    Map<String, byte[]> images = new HashMap<>();

    images.put(
        "_image_1_0_en_US",
        FileUtil.getBytes(clazz, "/com/liferay/journal/dependencies/liferay.png"));

    baseModel =
        JournalTestUtil.addArticleWithXMLContent(
            JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID,
            content,
            ddmStructure.getStructureKey(),
            ddmTemplate.getTemplateKey(),
            images,
            serviceContext);

    Assert.assertEquals(
        initialArticleImagesCount + 1,
        JournalArticleImageLocalServiceUtil.getArticleImagesCount(group.getGroupId()));

    moveBaseModelToTrash((Long) baseModel.getPrimaryKeyObj());

    TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(getBaseModelClassName());

    trashHandler.deleteTrashEntry(getTrashEntryClassPK(baseModel));

    Assert.assertEquals(
        initialArticleImagesCount,
        JournalArticleImageLocalServiceUtil.getArticleImagesCount(group.getGroupId()));
  }
  protected void setUpDDMFormXSDDeserializerUtil() {
    DDMFormXSDDeserializerUtil ddmFormXSDDeserializerUtil = new DDMFormXSDDeserializerUtil();

    ddmFormXSDDeserializerUtil.setDDMFormXSDDeserializer(new DDMFormXSDDeserializerImpl());
  }