PropertyResourceBundleControl extends ResourceBundle.Control { public static final ResourceBundle.Control newControl(final String encoding) throws UnsupportedCharsetException { Charset.forName(encoding); final ResourceBundle.Control existedControl = getControl(encoding); ResourceBundle.Control control = existedControl; if (existedControl == null) { control = new PropertyResourceBundleControl(encoding); encodingControlMap.put(encoding, control); } return control; } protected  PropertyResourceBundleControl(final String encoding); protected  PropertyResourceBundleControl(); static final ResourceBundle.Control newControl(final String encoding); final List<String> getFormats(String baseName); ResourceBundle newBundle(String baseName, Locale locale, String format, final ClassLoader classLoader, final boolean reload); String getEncoding();  }
@Test public void testNewControl() { SortedMap<String, Charset> charsetsSortedMap = Charset.availableCharsets(); for (String encoding : charsetsSortedMap.keySet()) { ResourceBundle.Control control = PropertyResourceBundleControl.newControl(encoding); Assert.assertNotNull(control); } }
@Test(expected = UnsupportedCharsetException.class) public void testNewControlOnException() { PropertyResourceBundleControl.newControl("NON-SUPPORTED-ENCODING"); }