Browse Source

Switch test to use a specific locale for which we have a message file (french). The default ResourceBundle behaviour is to attempt to load the platform locale if the specified one isn't found before using the default. We don't have a messages_en.properties file, hence trying to use "en" locale on a Chinese computer will result in Chinese messages being used (and test failing).

2.0.x
Luke Taylor 19 years ago
parent
commit
92bc57eefd
  1. 6
      core/src/test/java/org/springframework/security/SpringSecurityMessageSourceTests.java

6
core/src/test/java/org/springframework/security/SpringSecurityMessageSourceTests.java

@ -51,12 +51,12 @@ public class SpringSecurityMessageSourceTests extends TestCase { @@ -51,12 +51,12 @@ public class SpringSecurityMessageSourceTests extends TestCase {
public void testReplacableLookup() {
// Change Locale to English
Locale before = LocaleContextHolder.getLocale();
LocaleContextHolder.setLocale(Locale.ENGLISH);
LocaleContextHolder.setLocale(Locale.FRENCH);
// Cause a message to be generated
MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
assertEquals("Missing mandatory digest value; received header FOOBAR",
messages.getMessage("DigestProcessingFilter.missingMandatory", new Object[] {"FOOBAR"},
assertEquals("Le jeton nonce est compromis FOOBAR",
messages.getMessage("DigestProcessingFilter.nonceCompromised", new Object[] {"FOOBAR"},
"ERROR - FAILED TO LOOKUP"));
// Revert to original Locale

Loading…
Cancel
Save