### Question:
I18nProviderImpl extends AbstractGuavaCacheMBean<String,I18n> implements I18nProvider { @Override public I18n i18n(final Resource resource) { final I18n cached = cache.getIfPresent(resource.getPath()); if (cached != null) { return cached; } final I18n i18n = i18n(getResourceBundleFromPageLocale(resource)); cache.put(resource.getPath(), i18n); return i18n; } I18nProviderImpl(); @Override String translate(final String key, final Resource resource); @Override String translate(final String key, final Locale locale); @Override String translate(final String key, final HttpServletRequest request); @Override I18n i18n(final Resource resource); @Override I18n i18n(final Locale locale); @Override I18n i18n(final HttpServletRequest request);  }### Answer:
@Test public void test_i18n_locale() { final I18n mocked = mock(I18n.class); doReturn(mocked).when(i18nProvider).i18n(resourceBundle); final I18n actual = i18nProvider.i18n(LOCALE); assertSame(mocked, actual); }
@Test public void test_i18n_resource() { final I18n mocked = mock(I18n.class); doReturn(mocked).when(i18nProvider).i18n(resourceBundle); final I18n actual = i18nProvider.i18n(resource); assertSame(mocked, actual); }
@Test public void test_i18n_resource_withcaching() { final I18n mocked = mock(I18n.class); doReturn(mocked).when(i18nProvider).i18n(resourceBundle); final I18n actual = i18nProvider.i18n(resource); assertSame(mocked, actual); final I18n cached = i18nProvider.i18n(resource); assertSame(actual, cached); }