@Test public void formatPriceStringUsingFree_whenZero_rendersFree() { assertEquals( PaymentUtils.formatPriceStringUsingFree( 0, Currency.getInstance("USD"), "Free"), "Free"); }
static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) { if (amount == 0) { return free; } NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat).getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault())); ((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols); return formatPriceString(amount, currency); }
PaymentUtils { static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) { if (amount == 0) { return free; } NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat).getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault())); ((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols); return formatPriceString(amount, currency); } }
PaymentUtils { static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) { if (amount == 0) { return free; } NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat).getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault())); ((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols); return formatPriceString(amount, currency); }  }
PaymentUtils { static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) { if (amount == 0) { return free; } NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat).getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault())); ((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols); return formatPriceString(amount, currency); }   }
PaymentUtils { static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) { if (amount == 0) { return free; } NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat).getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault())); ((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols); return formatPriceString(amount, currency); }    }