Prove placeholders work correctly.

This commit is contained in:
Ben Alex 2005-12-01 00:30:18 +00:00
parent 271d5ac96c
commit b16ce31c5b
1 changed files with 18 additions and 0 deletions

View File

@ -17,6 +17,9 @@ package org.acegisecurity;
import junit.framework.TestCase;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.MessageSourceAccessor;
import java.util.Locale;
@ -45,4 +48,19 @@ public class AcegiMessageSourceTests extends TestCase {
assertEquals("Proxy tickets are rejected",
msgs.getMessage("RejectProxyTickets.reject", null, Locale.ENGLISH));
}
public void testReplacableLookup() {
// Change Locale to English
Locale before = LocaleContextHolder.getLocale();
LocaleContextHolder.setLocale(Locale.ENGLISH);
// Cause a message to be generated
MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
assertEquals("Missing mandatory digest value; received header FOOBAR",
messages.getMessage("DigestProcessingFilter.missingMandatory",
new Object[] {"FOOBAR"}, "ERROR - FAILED TO LOOKUP"));
// Revert to original Locale
LocaleContextHolder.setLocale(before);
}
}