### Question:
BundleUtils { public static ResourceBundle getBundle(Class<?> cls) { try { ClassLoader loader = getClassLoader(cls); if (loader == null) { return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault()); } return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault(), loader); } catch (MissingResourceException ex) { ClassLoader loader = getContextClassLoader(); if (loader == null) { return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault()); } return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault(), loader); } } private  BundleUtils(); static String getBundleName(Class<?> cls); static String getBundleName(Class<?> cls, String name); static ResourceBundle getBundle(Class<?> cls); static ResourceBundle getBundle(Class<?> cls, String name); static String getFormattedString(ResourceBundle b, String key, Object ... params);  }### Answer:
@Test public void testGetBundle() throws Exception { ResourceBundle bundle = BundleUtils.getBundle(getClass()); assertNotNull("expected resource bundle", bundle); assertEquals("unexpected resource", "localized message", bundle.getString("I18N_MSG")); ResourceBundle nonDefaultBundle = BundleUtils.getBundle(getClass(), "Messages"); assertNotNull("expected resource bundle", nonDefaultBundle); assertEquals("unexpected resource", "localized message", nonDefaultBundle.getString("I18N_MSG")); }