BtcFormat extends Format { public static BtcFormat getSymbolInstance() { return getSymbolInstance(defaultLocale()); } protected  BtcFormat(DecimalFormat numberFormat, int minDecimals, List<Integer> groups); static Builder builder(); static BtcFormat getInstance(); static BtcFormat getSymbolInstance(); static BtcFormat getCodeInstance(); static BtcFormat getSymbolInstance(int fractionPlaces); static BtcFormat getCodeInstance(int minDecimals); static BtcFormat getInstance(Locale locale); static BtcFormat getCodeInstance(Locale locale); static BtcFormat getInstance(Locale locale, int minDecimals); static BtcFormat getCodeInstance(Locale locale, int minDecimals); static BtcFormat getSymbolInstance(Locale locale); static BtcFormat getSymbolInstance(Locale locale, int fractionPlaces); static BtcFormat getInstance(Style style); static BtcFormat getInstance(Style style, int fractionPlaces); static BtcFormat getInstance(Style style, Locale locale); static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces); static BtcFormat getCoinInstance(); static BtcFormat getCoinInstance(int minFractionPlaces, int... groups); static BtcFormat getCoinInstance(Locale locale); static BtcFormat getCoinInstance(Locale locale, int scale, int... groups); static BtcFormat getMilliInstance(); static BtcFormat getMilliInstance(Locale locale); static BtcFormat getMilliInstance(int scale, int... groups); static BtcFormat getMilliInstance(Locale locale, int scale, int... groups); static BtcFormat getMicroInstance(); static BtcFormat getMicroInstance(Locale locale); static BtcFormat getMicroInstance(int scale, int... groups); static BtcFormat getMicroInstance(Locale locale, int scale, int... groups); static BtcFormat getInstance(int scale, int minDecimals, int... groups); static BtcFormat getInstance(int scale); static BtcFormat getInstance(int scale, Locale locale); static BtcFormat getInstance(int scale, Locale locale, int minDecimals, int... groups); static BtcFormat getInstance(int scale, Locale locale, int minDecimals, List<Integer> groups); @Override AttributedCharacterIterator formatToCharacterIterator(Object obj); @Override StringBuffer format(Object qty, StringBuffer toAppendTo, FieldPosition pos); String format(Object qty, int minDecimals, int... fractionGroups); StringBuffer format(Object qty, StringBuffer toAppendTo, FieldPosition pos,
                                            int minDecimals, int... fractionGroups); @Override final Object parseObject(String source, ParsePosition pos); Coin parse(String source, ParsePosition pos); Coin parse(String source); static Locale[] getAvailableLocales(); String coinSymbol(); String coinCode(); String pattern(); DecimalFormatSymbols symbols(); @Override boolean equals(Object o); @Override int hashCode(); static final int COIN_SCALE; static final int MILLICOIN_SCALE; static final int MICROCOIN_SCALE; }
@Test public void prefixTest() { BtcFormat usFormat = BtcFormat.getSymbolInstance(Locale.US); assertEquals("Đ1.00", usFormat.format(COIN)); assertEquals("Đ1.01", usFormat.format(101000000)); assertEquals("₥Đ0.01", usFormat.format(1000)); assertEquals("₥Đ1,011.00", usFormat.format(101100000)); assertEquals("₥Đ1,000.01", usFormat.format(100001000)); assertEquals("µĐ1,000,001.00", usFormat.format(100000100)); assertEquals("µĐ1,000,000.10", usFormat.format(100000010)); assertEquals("µĐ1,000,000.01", usFormat.format(100000001)); assertEquals("µĐ1.00", usFormat.format(100)); assertEquals("µĐ0.10", usFormat.format(10)); assertEquals("µĐ0.01", usFormat.format(1)); }
@Test public void suffixTest() { BtcFormat deFormat = BtcFormat.getSymbolInstance(Locale.GERMANY); assertEquals("1,00 Đ", deFormat.format(100000000)); assertEquals("1,01 Đ", deFormat.format(101000000)); assertEquals("1.011,00 ₥Đ", deFormat.format(101100000)); assertEquals("1.000,01 ₥Đ", deFormat.format(100001000)); assertEquals("1.000.001,00 µĐ", deFormat.format(100000100)); assertEquals("1.000.000,10 µĐ", deFormat.format(100000010)); assertEquals("1.000.000,01 µĐ", deFormat.format(100000001)); }