Test for message properties

This commit is contained in:
Dave Syer 2014-06-11 16:39:50 +01:00
parent f5f3903538
commit 32a220da8f
2 changed files with 20 additions and 0 deletions

View File

@ -18,9 +18,12 @@ package org.springframework.boot.autoconfigure;
import java.util.Locale; import java.util.Locale;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -81,4 +84,20 @@ public class MessageSourceAutoConfigurationTests {
assertEquals("blah", this.context.getMessage("foo", null, "blah", Locale.UK)); assertEquals("blah", this.context.getMessage("foo", null, "blah", Locale.UK));
} }
@Test
@Ignore("Expected to fail per gh-1075")
public void testMessageSourceFromPropertySourceAnnotation() throws Exception {
this.context = new AnnotationConfigApplicationContext();
this.context.register(Config.class, MessageSourceAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
assertEquals("bar",
this.context.getMessage("foo", null, "Foo message", Locale.UK));
}
@Configuration
@PropertySource("classpath:/switch-messages.properties")
protected static class Config {
}
} }

View File

@ -0,0 +1 @@
spring.messages.basename:test/messages