Skip to content

Commit 32a220d

Browse files
author
Dave Syer
committed
Test for message properties
1 parent f5f3903 commit 32a220d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919
import java.util.Locale;
2020

21+
import org.junit.Ignore;
2122
import org.junit.Test;
2223
import org.springframework.boot.test.EnvironmentTestUtils;
2324
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
25+
import org.springframework.context.annotation.Configuration;
26+
import org.springframework.context.annotation.PropertySource;
2427

2528
import static org.junit.Assert.assertEquals;
2629

@@ -81,4 +84,20 @@ public void testBadEncoding() throws Exception {
8184
assertEquals("blah", this.context.getMessage("foo", null, "blah", Locale.UK));
8285
}
8386

87+
@Test
88+
@Ignore("Expected to fail per gh-1075")
89+
public void testMessageSourceFromPropertySourceAnnotation() throws Exception {
90+
this.context = new AnnotationConfigApplicationContext();
91+
this.context.register(Config.class, MessageSourceAutoConfiguration.class,
92+
PropertyPlaceholderAutoConfiguration.class);
93+
this.context.refresh();
94+
assertEquals("bar",
95+
this.context.getMessage("foo", null, "Foo message", Locale.UK));
96+
}
97+
98+
@Configuration
99+
@PropertySource("classpath:/switch-messages.properties")
100+
protected static class Config {
101+
102+
}
84103
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.messages.basename:test/messages

0 commit comments

Comments
 (0)