ICUHumanize { public static MessageFormat messageFormatInstance(final String pattern) { MessageFormat msg = context.get().getMessageFormat(); msg.applyPattern(pattern); return msg; } private  ICUHumanize(); static String compactDecimal(final Number value); static String compactDecimal(final Number value, final CompactStyle style); static String compactDecimal(final Number value, final CompactStyle style, final Locale locale); static String compactDecimal(final Number value, final Locale locale); static DateFormat dateFormatInstance(final String pattern); static DateFormat dateFormatInstance(final String pattern, final Locale locale); static DecimalFormat decimalFormatInstance(final String pattern); static DecimalFormat decimalFormatInstance(final String pattern, final Locale locale); static String duration(final Number value); static String format(final String pattern, final Object... args); static String formatCurrency(final Number value); static String formatCurrency(final Number value, final Locale locale); static String formatDate(final Date value); static String formatDate(final Date value, final Locale locale); static String formatDate(final Date value, final String pattern); static String formatDate(final Date value, final String pattern, final Locale locale); static String formatDate(final int style, final Date value); static String formatDate(final int style, final Date value, final Locale locale); static String formatDateTime(final Date value); static String formatDateTime(final Date value, final Locale locale); static String formatDateTime(final int dateStyle, final int timeStyle, final Date value); static String formatDateTime(final int dateStyle, final int timeStyle, final Date value, final Locale locale); static String formatDecimal(final Number value); static String formatDecimal(final Number value, final Locale locale); static String formatPercent(final Number value); static String formatPercent(final Number value, final Locale locale); static String formatPluralCurrency(final Number value); static String formatPluralCurrency(final Number value, final Locale locale); static MessageFormat messageFormatInstance(final String pattern); static MessageFormat messageFormatInstance(final String pattern, final Locale locale); static String naturalDay(final Date value); static String naturalDay(final Date value, final Locale locale); static String naturalDay(final int style, final Date value); static String naturalTime(final Date duration); static String naturalTime(final Date reference, final Date duration); static String naturalTime(final Date reference, final Date duration, final Locale locale); static String naturalTime(final Date duration, final Locale locale); static String ordinalize(final Number value); static String ordinalize(final Number value, final Locale locale); static Number parseNumber(final String text); static Number parseNumber(final String text, final Locale locale); static String pluralize(final Locale locale, final String pattern, final Number value,
            final Object... args); static String pluralize(final String pattern, final Number value, final Object... args); static String replaceSupplementary(final String value); static String smartDateFormat(final Date value, final String skeleton); static String smartDateFormat(final Date value, final String skeleton, final Locale locale); static String spellNumber(final Number value); static String spellNumber(final Number value, final Locale locale); static String transliterate(final String text); static String transliterate(final String text, final String id);  }
@Test(threadPoolSize = 10, invocationCount = 10) public void pluralizeWithFormatInstance() { int df = rand.nextInt(9); MessageFormat f = messageFormatInstance("There {0, plural, one{is one file}other{are {0} files}} on {1}."); assertEquals(f.render(1000 + df, "disk"), "There are 1,00" + df + " files on disk."); assertEquals(f.render(0, "disk"), "There are 0 files on disk."); assertEquals(f.render(-1, "disk"), "There are -1 files on disk."); assertEquals(f.render(1, "disk"), "There is one file on disk."); assertEquals(f.render(1, "disk", 1000, "bla bla"), "There is one file on disk."); f = messageFormatInstance("Hay {0, plural, one{un fichero}other{{0} ficheros}} en {1}.", ES); assertEquals(f.render(1000 + df, "disco"), "Hay 1.00" + df + " ficheros en disco."); assertEquals(f.render(1, "disco"), "Hay un fichero en disco."); }