|
16 | 16 |
|
17 | 17 | package org.springframework.context.config;
|
18 | 18 |
|
19 |
| -import java.io.FileNotFoundException; |
20 | 19 | import java.util.Calendar;
|
21 | 20 | import java.util.Date;
|
22 | 21 |
|
|
30 | 29 | import org.springframework.core.io.ClassPathResource;
|
31 | 30 | import org.springframework.mock.env.MockEnvironment;
|
32 | 31 |
|
33 |
| -import static org.junit.Assert.*; |
| 32 | +import static org.junit.Assert.assertEquals; |
| 33 | +import static org.junit.Assert.assertTrue; |
| 34 | +import static org.junit.Assert.fail; |
34 | 35 |
|
35 | 36 | /**
|
36 | 37 | * @author Arjen Poutsma
|
@@ -128,14 +129,14 @@ public void propertyPlaceholderLocationWithSystemPropertyForMultipleLocations()
|
128 | 129 | @Test
|
129 | 130 | public void propertyPlaceholderLocationWithSystemPropertyMissing() {
|
130 | 131 | try {
|
131 |
| - ApplicationContext applicationContext = new ClassPathXmlApplicationContext( |
| 132 | + new ClassPathXmlApplicationContext( |
132 | 133 | "contextNamespaceHandlerTests-location-placeholder.xml", getClass());
|
133 |
| - assertEquals("bar", applicationContext.getBean("foo")); |
134 |
| - assertEquals("foo", applicationContext.getBean("bar")); |
135 |
| - assertEquals("maps", applicationContext.getBean("spam")); |
| 134 | + fail("Should have thrown FatalBeanException"); |
136 | 135 | }
|
137 | 136 | catch (FatalBeanException ex) {
|
138 |
| - assertTrue(ex.getRootCause() instanceof FileNotFoundException); |
| 137 | + Throwable cause = ex.getRootCause(); |
| 138 | + assertTrue(cause instanceof IllegalArgumentException); |
| 139 | + assertEquals("Could not resolve placeholder 'foo' in value \"${foo}\"", cause.getMessage()); |
139 | 140 | }
|
140 | 141 | }
|
141 | 142 |
|
|
0 commit comments