FormatUtils { @NonNull static final Format asFormat(final String pattern, final Locale locale) { final NumberFormat localizedFormat = NumberFormat.getNumberInstance(locale); final DecimalFormat outputFormat = (DecimalFormat) localizedFormat; outputFormat.applyPattern(pattern); return outputFormat; } private  FormatUtils();   }
@Test public void shouldCreateFormat() { final String pattern = "#.#"; final Locale locale = Locale.GERMAN; final Format format = FormatUtils.asFormat(pattern, locale); Assert.assertNotNull(format); }