Closed
Description
@Test
public void resolvePreferredAgainstLanguageOnly() {
this.resolver.setSupportedLocales(Arrays.asList(GERMANY, US));
assertThat(this.resolver.resolveLocaleContext(exchange(UK, ENGLISH)).getLocale()).isEqualTo(US);
}
This test should pass. If a client requests en-GB, en
and the supported locales are de-DE, en-US
then this should resolve to US because en
(English of any kind) matches en-US
(US English). Instead it incorrectly resolves to en-GB
.
Note: There is an existing test with the same name that I believe has this wrong:
@Test
public void resolvePreferredAgainstLanguageOnly() {
this.resolver.setSupportedLocales(Collections.singletonList(ENGLISH));
assertThat(this.resolver.resolveLocaleContext(exchange(GERMANY, US, UK)).getLocale()).isEqualTo(ENGLISH);
}
This test should also pass but not because it "matches" -- it should resolve to ENGLISH because that's the only supported locale.
This affects all versions.