### Question:
DefaultI18nContext implements I18nContext { @EventListener public void refresh(SetLocaleEvent e) { String localeString = e.getLocaleString(); if (StringUtils.isNotBlank(localeString)) { LOG.trace("Setting default locale to {}", localeString); Optional.ofNullable(Locale.forLanguageTag(localeString)).filter(supportedLocales::contains) .ifPresent(Locale::setDefault); refreshBundles(); } } DefaultI18nContext(); @EventListener void refresh(SetLocaleEvent e); static I18nContext getInstance(); @Override String i18n(String input); @Override String i18n(String input, String value); @Override String i18n(String input, String value0, String value1); @Override Set<Locale> getSupportedLocales();  }### Answer:
@Test public void refreshSets() { DefaultI18nContext victim = new DefaultI18nContext(); Locale.setDefault(Locale.UK); victim.refresh(new SetLocaleEvent(Locale.ITALIAN.toLanguageTag())); assertEquals(Locale.ITALIAN, Locale.getDefault()); }
@Test public void refreshNotExistingDoesntExplode() { DefaultI18nContext victim = new DefaultI18nContext(); Locale.setDefault(Locale.UK); victim.refresh(new SetLocaleEvent("Chuck Norris")); assertEquals(Locale.UK, Locale.getDefault()); }