### Question:
ReportService { public String customNumberFormat(String pattern, String locale, double value) { DecimalFormat formatter = null; Locale _locale = getLocaleFromString(locale); if (_locale != null) { formatter = (DecimalFormat) DecimalFormat.getInstance(getLocaleFromString(locale)); } else { formatter = (DecimalFormat) DecimalFormat.getInstance(); } formatter.applyPattern(pattern); String output = formatter.format(value); return output; }  ItemCollection findReport(String reportID); List<ItemCollection> findAllReports(); void updateReport(ItemCollection aReport); @SuppressWarnings("unchecked") List<ItemCollection> getDataSource(ItemCollection reportEntity, int pageSize, int pageIndex, String sortBy,
            boolean sortReverse, Map<String, String> params); FileData transformDataSource(ItemCollection report, List<ItemCollection> data, String fileName); Calendar computeDynamicDate(String xmlDate); String replaceDateString(String content); String customNumberFormat(String pattern, String locale, double value);  }### Answer:
@Test public void testFormatNumber() { ReportService reportService=new ReportService(); Assert.assertEquals("123,456.789", reportService.customNumberFormat("###,###.###", "en_UK", 123456.789)); Assert.assertEquals("123,456.789", reportService.customNumberFormat("###,###.###", "en_US", 123456.789)); Assert.assertEquals("123,456.79", reportService.customNumberFormat("###,##0.00", "en_US", 123456.789)); Assert.assertEquals("1.456,78", reportService.customNumberFormat("#,###,##0.00", "de_DE", 1456.781)); Assert.assertEquals("1.456,78 €", reportService.customNumberFormat("#,###,##0.00 €", "de_DE", 1456.781)); Assert.assertEquals("EUR 1.456,78", reportService.customNumberFormat("EUR #,###,##0.00", "de_DE", 1456.781)); }