### Question:
ResourceBundleFinder { public ResourceBundle getForCurrentLocale(FacesContext facesContext) { Application application = facesContext.getApplication(); String bundleName = application.getMessageBundle(); if (bundleName == null) { return defaultStellaBundle(); } Locale locale = facesContext.getViewRoot().getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale); return bundle; }  ResourceBundle getForCurrentLocale(FacesContext facesContext);  }### Answer:
@Test public void deveRetornarMessageBundleDoFacesConfigSeExistir() { FacesContext ctx = mockery.mock(FacesContext.class); mocker.mockMessageBundle(ctx, "messages", new Locale("pt", "BR")); ResourceBundle messages = resourceBundleFinder.getForCurrentLocale(ctx); String invalidCPFMessage = messages.getString("cpferror.invalid_digits"); assertEquals("CPF Invalido", invalidCPFMessage); }
@Test public void deveRetornarMessageBundleDoStellaCasoNaoExistaNoFacesConfig() { FacesContext ctx = mockery.mock(FacesContext.class); mocker.mockMessageBundle(ctx, null, new Locale("pt", "BR")); ResourceBundle stellaMessages = resourceBundleFinder.getForCurrentLocale(ctx); String invalidCPFMessage = stellaMessages.getString("cpferror.invalid_check_digits"); assertEquals("CPF com digito(s) verificador(es) inválido(s)", invalidCPFMessage); }