### Question:
DefaultI18nContext implements I18nContext { Locale getBestLocale() { if (supportedLocales.contains(Locale.getDefault())) { LOG.trace("Using best matching locale: {}", Locale.getDefault()); return Locale.getDefault(); } Locale onlyLanguage = new Locale(Locale.getDefault().getLanguage()); if (supportedLocales.contains(onlyLanguage)) { LOG.trace("Using supported locale closest to default {}", onlyLanguage); return onlyLanguage; } LOG.trace("Using fallback locale"); return Locale.UK; } 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 getBestLocaleNotSupported() { DefaultI18nContext victim = new DefaultI18nContext(); Locale.setDefault(Locale.CANADA); assertEquals(Locale.UK, victim.getBestLocale()); }
@Test public void getBestLocaletSupported() { DefaultI18nContext victim = new DefaultI18nContext(); Locale.setDefault(Locale.ITALIAN); assertEquals(Locale.ITALIAN, victim.getBestLocale()); }
@Test public void getBestLocaletLanguageSupported() { DefaultI18nContext victim = new DefaultI18nContext(); Locale.setDefault(Locale.CANADA_FRENCH); assertEquals(Locale.FRENCH, victim.getBestLocale()); }