// --------------------------------------------------------- Support Methods
 // Check that the properties of the NumberConverters are equal
 protected void checkNumberConverter(NumberConverter nc1, NumberConverter nc2) {
   assertEquals(nc1.getCurrencyCode(), nc2.getCurrencyCode());
   assertEquals(nc1.getCurrencySymbol(), nc2.getCurrencySymbol());
   assertEquals(nc1.isGroupingUsed(), nc2.isGroupingUsed());
   assertEquals(nc1.isIntegerOnly(), nc2.isIntegerOnly());
   assertEquals(nc1.getMaxFractionDigits(), nc2.getMaxFractionDigits());
   assertEquals(nc1.getMaxIntegerDigits(), nc2.getMaxIntegerDigits());
   assertEquals(nc1.getMinFractionDigits(), nc2.getMinFractionDigits());
   assertEquals(nc1.getMinIntegerDigits(), nc2.getMinIntegerDigits());
   assertEquals(nc1.getLocale(), nc2.getLocale());
   assertEquals(nc1.getPattern(), nc2.getPattern());
   assertEquals(nc1.getType(), nc2.getType());
 }
  @SuppressWarnings("deprecation")
  public void testWidgetProcessor() throws Exception {

    StandardConverterProcessor processor = new StandardConverterProcessor();

    HtmlInputText htmlInputText = new HtmlInputText();

    // Actions get no Converters

    processor.processWidget(htmlInputText, ACTION, null, null);
    assertEquals(null, htmlInputText.getConverter());

    // Empty attributes get no Converters

    Map<String, String> attributes = CollectionUtils.newHashMap();
    attributes.put(NAME, "foo");
    processor.processWidget(htmlInputText, PROPERTY, attributes, null);
    assertEquals(null, htmlInputText.getConverter());
    assertEquals(null, htmlInputText.getLabel());

    // Explicit converter

    attributes.put(FACES_CONVERTER, "fooConverter");
    processor.processWidget(htmlInputText, PROPERTY, attributes, null);
    assertEquals("fooConverter", htmlInputText.getConverter().toString());

    // Explicit EL-based converter

    attributes.put(FACES_CONVERTER, "#{foo.converter}");
    htmlInputText = new HtmlInputText();
    processor.processWidget(htmlInputText, PROPERTY, attributes, null);
    assertEquals(
        "#{foo.converter}", htmlInputText.getValueBinding("converter").getExpressionString());
    attributes.remove(FACES_CONVERTER);

    // Implicit DateTimeConverter

    attributes.put(TYPE, Date.class.getName());
    htmlInputText = new HtmlInputText();
    processor.processWidget(htmlInputText, PROPERTY, attributes, new HtmlMetawidget());
    assertTrue(htmlInputText.getConverter() instanceof DateTimeConverter);
    htmlInputText = new HtmlInputText();

    // DateTimeConverter

    attributes.put(DATE_STYLE, "full");
    attributes.put(TIME_STYLE, "medium");
    attributes.put(LOCALE, "UK");
    attributes.put(DATETIME_PATTERN, "dd/MM/yyyy");
    attributes.put(TIME_ZONE, "Australia/Sydney");
    attributes.put(DATETIME_TYPE, "date");
    processor.processWidget(htmlInputText, PROPERTY, attributes, new HtmlMetawidget());
    assertEquals(null, htmlInputText.getLabel());

    DateTimeConverter dateTimeConverter = (DateTimeConverter) htmlInputText.getConverter();
    assertEquals("full", dateTimeConverter.getDateStyle());
    assertEquals("medium", dateTimeConverter.getTimeStyle());
    assertEquals("uk", dateTimeConverter.getLocale().getLanguage());
    assertEquals("dd/MM/yyyy", dateTimeConverter.getPattern());
    assertEquals("Australia/Sydney", dateTimeConverter.getTimeZone().getID());
    assertEquals("date", dateTimeConverter.getType());

    // NumberConverter

    attributes.clear();
    attributes.put(CURRENCY_CODE, "AUD");
    attributes.put(CURRENCY_SYMBOL, "$");
    attributes.put(NUMBER_USES_GROUPING_SEPARATORS, TRUE);
    attributes.put(LOCALE, "AU");
    attributes.put(MINIMUM_FRACTIONAL_DIGITS, "0");
    attributes.put(MAXIMUM_FRACTIONAL_DIGITS, "1");
    attributes.put(MINIMUM_INTEGER_DIGITS, "2");
    attributes.put(MAXIMUM_INTEGER_DIGITS, "5");
    attributes.put(NUMBER_PATTERN, "#0.00");
    attributes.put(NUMBER_TYPE, "currency");

    // (should not overwrite existing Converter)

    processor.processWidget(htmlInputText, PROPERTY, attributes, null);
    assertEquals(dateTimeConverter, htmlInputText.getConverter());
    htmlInputText.setConverter(null);
    processor.processWidget(htmlInputText, PROPERTY, attributes, null);

    NumberConverter numberConverter = (NumberConverter) htmlInputText.getConverter();
    assertEquals("AUD", numberConverter.getCurrencyCode());
    assertEquals("$", numberConverter.getCurrencySymbol());
    assertTrue(numberConverter.isGroupingUsed());
    assertEquals("au", numberConverter.getLocale().getLanguage());
    assertEquals(0, numberConverter.getMinFractionDigits());
    assertEquals(1, numberConverter.getMaxFractionDigits());
    assertEquals(2, numberConverter.getMinIntegerDigits());
    assertEquals(5, numberConverter.getMaxIntegerDigits());
    assertEquals("#0.00", numberConverter.getPattern());
    assertEquals("currency", numberConverter.getType());
  }