// There seems to be a bug in the optimizer of 1.6.0_45 so that the output
// values are sometimes reordered - dunno why :(
@Test
  public void testGetFormatted ()
  {
    IMutableCurrencyValue aCV = new CurrencyValue (ECurrency.EUR, MathHelper.toBigDecimal (5));
    if (EJavaVersion.JDK_9.isSupportedVersion ())
      assertEquals ("5,00" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ());
    else
      assertEquals ("€" + CURRENCY_SPACE + "5,00", aCV.getCurrencyFormatted ());
    aCV = new CurrencyValue (ECurrency.EUR, new BigDecimal ("5.12"));
    if (EJavaVersion.JDK_9.isSupportedVersion ())
      assertEquals ("5,12" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ());
    else
      assertEquals ("€" + CURRENCY_SPACE + "5,12", aCV.getCurrencyFormatted ());
    aCV = new CurrencyValue (ECurrency.USD, new BigDecimal ("5.12"));
    assertEquals ("$5.12", aCV.getCurrencyFormatted ());
    for (final ECurrency eCurrency : ECurrency.values ())
    {
      aCV = new CurrencyValue (eCurrency, new BigDecimal ("5.12"));
      final String sCurrencyFormatted = aCV.getCurrencyFormatted ();
      assertNotNull (sCurrencyFormatted);
      final String sValueFormatted = aCV.getValueFormatted ();
      assertNotNull (sValueFormatted);
      assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0);
      CommonsTestHelper.testGetClone (aCV);
      // There seems to be a bug in the optimizer of 1.6.0_45 so that the output
      // values are sometimes reordered - dunno why :(
      LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]");
    }
  }
assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0);
CommonsTestHelper.testGetClone (aCV);
// There seems to be a bug in the optimizer of 1.6.0_45 so that the output
// values are sometimes reordered - dunno why :(
LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]");
}
assertEquals ("$5.12", aCV.getCurrencyFormatted ());
for (final ECurrency eCurrency : ECurrency.values ())
{
aCV = new CurrencyValue (eCurrency, new BigDecimal ("5.12"));
final String sCurrencyFormatted = aCV.getCurrencyFormatted ();
assertNotNull (sCurrencyFormatted);
final String sValueFormatted = aCV.getValueFormatted ();
assertNotNull (sValueFormatted);
assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0);
CommonsTestHelper.testGetClone (aCV);
// There seems to be a bug in the optimizer of 1.6.0_45 so that the output
// values are sometimes reordered - dunno why :(
LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]");
}
}
if (EJavaVersion.JDK_9.isSupportedVersion ())
assertEquals ("5,00" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ());
else
assertEquals ("€" + CURRENCY_SPACE + "5,00", aCV.getCurrencyFormatted ());
aCV = new CurrencyValue (ECurrency.EUR, new BigDecimal ("5.12"));
if (EJavaVersion.JDK_9.isSupportedVersion ())
assertEquals ("5,12" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ());
else
assertEquals ("€" + CURRENCY_SPACE + "5,12", aCV.getCurrencyFormatted ());
aCV = new CurrencyValue (ECurrency.USD, new BigDecimal ("5.12"));
assertEquals ("$5.12", aCV.getCurrencyFormatted ());
for (final ECurrency eCurrency : ECurrency.values ())
{
aCV = new CurrencyValue (eCurrency, new BigDecimal ("5.12"));
final String sCurrencyFormatted = aCV.getCurrencyFormatted ();
assertNotNull (sCurrencyFormatted);
final String sValueFormatted = aCV.getValueFormatted ();
assertNotNull (sValueFormatted);
assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0);
CommonsTestHelper.testGetClone (aCV);
// There seems to be a bug in the optimizer of 1.6.0_45 so that the output
// values are sometimes reordered - dunno why :(
LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]");
}
}