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).

This commit is contained in:
Luke Taylor 2007-10-11 15:16:06 +00:00
parent 650a5467e8
commit 92bc57eefd
1 changed files with 3 additions and 3 deletions

View File

@ -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