Browse Source

Test for message properties

pull/1082/head
Dave Syer 12 years ago
parent
commit
32a220da8f
  1. 19
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationTests.java
  2. 1
      spring-boot-autoconfigure/src/test/resources/switch-messages.properties

19
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationTests.java

@ -18,9 +18,12 @@ package org.springframework.boot.autoconfigure; @@ -18,9 +18,12 @@ package org.springframework.boot.autoconfigure;
import java.util.Locale;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import static org.junit.Assert.assertEquals;
@ -81,4 +84,20 @@ public class MessageSourceAutoConfigurationTests { @@ -81,4 +84,20 @@ public class MessageSourceAutoConfigurationTests {
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 {
}
}

1
spring-boot-autoconfigure/src/test/resources/switch-messages.properties

@ -0,0 +1 @@ @@ -0,0 +1 @@
spring.messages.basename:test/messages
Loading…
Cancel
Save