### Question:
BundleLoader { public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale) throws MissingResourceException { if (facesContext == null) { throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString()); } Application application = facesContext.getApplication(); if (application == null || application.getMessageBundle() == null) { throw new MissingResourceException("Cannot read message bundle name from application", getClass().getName(), messageKey.toString()); } return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader()); }  ResourceBundle getBundle(Enum<?> messageKey, Locale locale); ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale);  }### Answer:
@Test public void testGetApplicationBundle() throws Exception { expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.l10n.AppMessages"); facesEnvironment.replay(); assertEquals("Welcome to app", bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message, Locale.US) .getString("message")); assertEquals( "Dobro pozhalovat'", bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message, new Locale("by", "BY")).getString("message")); try { bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message, new Locale( "ru", "RU")); fail(); } catch (MissingResourceException e) { } }