protected void validateDDMFormFieldOptions(
      DDMFormField ddmFormField, Set<Locale> ddmFormAvailableLocales, Locale ddmFormDefaultLocale)
      throws DDMFormValidationException {

    String fieldType = ddmFormField.getType();

    if (!fieldType.equals(DDMFormFieldType.RADIO) && !fieldType.equals(DDMFormFieldType.SELECT)) {

      return;
    }

    DDMFormFieldOptions ddmFormFieldOptions = ddmFormField.getDDMFormFieldOptions();

    Set<String> optionValues = ddmFormFieldOptions.getOptionsValues();

    if (optionValues.isEmpty()) {
      throw new DDMFormValidationException(
          "At least one option should be set for field " + ddmFormField.getName());
    }

    for (String optionValue : ddmFormFieldOptions.getOptionsValues()) {
      LocalizedValue localizedValue = ddmFormFieldOptions.getOptionLabels(optionValue);

      validateDDMFormFieldPropertyValue(
          ddmFormField.getName(),
          "options",
          localizedValue,
          ddmFormAvailableLocales,
          ddmFormDefaultLocale);
    }
  }
  protected void addOptionsDynamicElements(
      DDMFormFieldOptions ddmFormFieldOptions, Element dynamicElementElement) {

    for (String optionValue : ddmFormFieldOptions.getOptionsValues()) {
      Element optionElement = addOptionDynamicElement(optionValue, dynamicElementElement);

      Map<Locale, Map<String, String>> optionLabelsMap =
          getOptionLabelsMap(ddmFormFieldOptions.getOptionLabels(optionValue));

      addMetadataElements(optionLabelsMap, optionElement);
    }
  }
  protected void assertEquals(
      DDMFormFieldOptions expectedDDMFormFieldOptions,
      DDMFormFieldOptions actualDDMFormFieldOptions) {

    Set<String> expectedOptionValues = expectedDDMFormFieldOptions.getOptionsValues();

    for (String expectedOptionValue : expectedOptionValues) {
      LocalizedValue expectedOptionLabels =
          expectedDDMFormFieldOptions.getOptionLabels(expectedOptionValue);

      LocalizedValue actualOptionLabels =
          actualDDMFormFieldOptions.getOptionLabels(expectedOptionValue);

      assertEquals(expectedOptionLabels, actualOptionLabels);
    }
  }