// verify the converter returns a valid value...
BigDecimal correctDecimal = new BigDecimal("123456.789");
Integer correctInteger = new Integer(123);
// ...for unstyled ints in default Locale
Integer anInteger = JavaLocalizedTypeUtil.convert("123", Integer.class, false, new AuraLocaleImpl());
assertNotNull("String to Integer with Locale was null", anInteger);
assertEquals("String to Integer with Locale was wrong", correctInteger, anInteger);
// ...for US format decimals
BigDecimal usDecimal = JavaLocalizedTypeUtil.convert("123,456.789", BigDecimal.class, false,
new AuraLocaleImpl(Locale.US));
assertNotNull("U.S. localized String to BigDecimal was null", usDecimal);
assertEquals("U.S. localized String to BigDecimal problem", correctDecimal, usDecimal);
// ...for de_DE format decimals
BigDecimal deDecimal = JavaLocalizedTypeUtil.convert("123.456,789", BigDecimal.class, false,
new AuraLocaleImpl(Locale.GERMANY));
assertNotNull("German localized String to BigDecimal was null", deDecimal);
assertEquals("German localized String to BigDecimal problem", correctDecimal, deDecimal);
// ...for fr format decimals
BigDecimal frDecimal = JavaLocalizedTypeUtil.convert("123456,789", BigDecimal.class, false, new AuraLocaleImpl(
Locale.FRANCE));
assertNotNull("France localized String to BigDecimal was null", frDecimal);
assertEquals("France localized String to BigDecimal problem", correctDecimal, frDecimal);
}