Package java.util

Examples of java.util.Currency$CurrencyNameGetter


    /**
     * @tests java.text.DecimalFormat#getCurrency()
     */
    //FIXME This test fails on Harmony ClassLibrary
    public void test_getCurrency() {
        Currency currK = Currency.getInstance("KRW");
        Currency currX = Currency.getInstance("XXX");
        Currency currE = Currency.getInstance("EUR");
        Currency curr01;

        DecimalFormat df = (DecimalFormat) NumberFormat
                .getCurrencyInstance(new Locale("ko", "KR"));
        assertTrue("Test1: Returned incorrect currency",
                df.getCurrency() == currK);
View Full Code Here


            df.setCurrency(null);
            fail("Expected NullPointerException");
        } catch (NullPointerException e) {
        }

        Currency currency = Currency.getInstance("AED");
        df.setCurrency(currency);
        assertTrue("Returned incorrect currency", currency == df.getCurrency());
        assertTrue("Returned incorrect currency symbol", currency.getSymbol(
                locale)
                .equals(df.getDecimalFormatSymbols().getCurrencySymbol()));
        assertTrue("Returned incorrect international currency symbol", currency
                .getCurrencyCode().equals(
                        df.getDecimalFormatSymbols()
                                .getInternationalCurrencySymbol()));
    }
View Full Code Here

        }


        // if still none we will use the default for whatever locale we can get...
        if (iso == null) {
            Currency cur = Currency.getInstance(getLocale(session));
            iso = cur.getCurrencyCode();
        }

        return iso;
    }
View Full Code Here

                if (numberType.equalsIgnoreCase("Currency"))
                {
                    String currencyCode = StringUtils.toString(column.getAttribute(InputControl.CURRENCY_CODE_ATTRIBUTE));
                    if (currencyCode!=null)
                    {   // nf = NumberFormat.getCurrencyInstance(locale);
                        Currency currency = Currency.getInstance(currencyCode);
                        return (currency!=null) ? currency.getSymbol() : null;
                    }
                } else if (numberType.equalsIgnoreCase("Percent"))
                {
                    return "%";
                }
View Full Code Here

  private static final String CURRENCY_SYMBOL = "$";
  private static final int FRACTION_DIGITS = 2;

  public void test(TestHarness harness)
  {
    Currency currency;

    /* Set the default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                  currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                  currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                  currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
View Full Code Here

  private static final String CURRENCY_SYMBOL = "NT$";
  private static final int FRACTION_DIGITS = 0;

  public void test(TestHarness harness)
  {
    Currency currency;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                  currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                  currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                  currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
View Full Code Here

  private static final int EURO_CHANGE_MONTH = 0;
  private static final int EURO_CHANGE_DATE = 1;

  public void test(TestHarness harness)
  {
    Currency currency;
    Calendar calendar;
    Calendar euroCalendar;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Get the current time in the locale */
    calendar = Calendar.getInstance(TEST_LOCALE);
    /* Get the Euro change-over time in the locale */
    euroCalendar = Calendar.getInstance(TEST_LOCALE);
    euroCalendar.set(EURO_CHANGE_YEAR, EURO_CHANGE_MONTH, EURO_CHANGE_DATE);
    /* Do different comparisons depending on the state of change to the Euro */
    if (calendar.after(euroCalendar))
      {
        /* Check for the correct currency code */
        harness.check(currency.getCurrencyCode(),EURO_ISO4217_CODE, "Euro ISO 4217 currency code retrieval check (" +
                      currency.getCurrencyCode() + ").");
        /* Check for the correct currency symbol */
        harness.check(currency.getSymbol(), EURO_CURRENCY_SYMBOL, "Euro currency symbol retrieval check (" +
                      currency.getSymbol() + ").");
        /* Check for the correct fraction digits */
        harness.check(currency.getDefaultFractionDigits(), EURO_FRACTION_DIGITS,
                      "Euro currency fraction digits retrieval check (" + currency.getDefaultFractionDigits() + ").");
        /* Check for the correct currency code from toString()*/
        harness.check(currency.toString(),EURO_ISO4217_CODE, "Euro ISO 4217 currency code retrieval check (" +
                      currency.toString() + ").");
      }
    else
      {
          /* Check for the correct currency code */
          harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                        currency.getCurrencyCode() + ").");
          /* Check for the correct currency symbol */
          harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                        currency.getSymbol() + ").");
          /* Check for the correct fraction digits */
          harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                        currency.getDefaultFractionDigits() + ").");
          /* Check for the correct currency code from toString()*/
          harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check ("
                        + currency.toString() + ").");
      }
  }
View Full Code Here

  private static final String CURRENCY_SYMBOL = "\uFFE6";
  private static final int FRACTION_DIGITS = 0;

  public void test(TestHarness harness)
  {
    Currency currency;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                  currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                  currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                  currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
View Full Code Here

  private static final String CURRENCY_SYMBOL = "\u00A3";
  private static final int FRACTION_DIGITS = 2;

  public void test(TestHarness harness)
  {
    Currency currency;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the UK currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                  currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                  currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                  currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
View Full Code Here

  private static final String CURRENCY_SYMBOL = "\uFFE5";
  private static final int FRACTION_DIGITS = 2;

  public void test(TestHarness harness)
  {
    Currency currency;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" +
                  currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" +
                  currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" +
                  currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
View Full Code Here

TOP

Related Classes of java.util.Currency$CurrencyNameGetter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.