AmountViewUtils { public static String getAmountString(Locale locale, Amount amount, boolean justTheNumber, boolean blankIfZero, boolean blankIfNull, boolean forceFraction, boolean stripOffSign) { if (amount != null) { StringBuilder result = new StringBuilder(); if (!justTheNumber) { result.append(CurrencyUtil.getSymbolToCurrency(null, amount.getUnit())).append(" "); } return getDoubleString(locale, amount.getValue(), blankIfZero, blankIfNull, forceFraction, stripOffSign, result); } return (blankIfNull) ? "" : null; }  static int getColor(Context context, Amount amount); static String getAmountString(Locale locale, Amount amount, boolean justTheNumber,
            boolean blankIfZero, boolean blankIfNull, boolean forceFraction, boolean stripOffSign); static String getDoubleString(Locale locale, Double value); static String getAmountString(Locale locale, Amount amount, boolean justTheNumber,
            boolean stripOffSign, boolean forceFraction); static String getAmountString(Locale locale, Amount amount, boolean justTheNumber, boolean stripOffSign); static String getAmountString(Locale locale, Amount amount, boolean justTheNumber); static String getAmountString(Locale locale, Amount amount);  }
@Test public void testGetAmountStringLocale() { Locale locale; boolean justTheNumber; boolean blankIfZero; boolean blankIfNull; boolean forceFraction; boolean stripOffSign; locale = Locale.UK; justTheNumber = true; blankIfZero = true; blankIfNull = true; forceFraction = true; stripOffSign = true; Amount inputAmount = createAmount("EUR", 9.19); Assert.assertEquals("9.19", AmountViewUtils.getAmountString(locale, inputAmount, justTheNumber, blankIfZero, blankIfNull, forceFraction, stripOffSign)); locale = Locale.GERMANY; Assert.assertEquals("9,19", AmountViewUtils.getAmountString(locale, inputAmount, justTheNumber, blankIfZero, blankIfNull, forceFraction, stripOffSign)); }
@Test public void testGetAmountStringFraction() { Locale locale; boolean justTheNumber; boolean blankIfZero; boolean blankIfNull; boolean forceFraction; boolean stripOffSign; locale = Locale.UK; justTheNumber = true; blankIfZero = true; blankIfNull = true; forceFraction = true; stripOffSign = true; Amount inputAmount = createAmount("EUR", 9.00); Assert.assertEquals("9.00", AmountViewUtils.getAmountString(locale, inputAmount, justTheNumber, blankIfZero, blankIfNull, forceFraction, stripOffSign)); forceFraction = false; Assert.assertEquals("9", AmountViewUtils.getAmountString(locale, inputAmount, justTheNumber, blankIfZero, blankIfNull, forceFraction, stripOffSign)); }