Skip to content

Commit 2667956

Browse files
committed
Initialize JNDI to fix failing Environment test
Issue: SPR-12223
1 parent c41ea96 commit 2667956

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616

1717
package org.springframework.web.context.support;
1818

19-
import static org.hamcrest.CoreMatchers.equalTo;
20-
import static org.hamcrest.CoreMatchers.is;
21-
import static org.junit.Assert.assertThat;
19+
import javax.naming.NamingException;
2220

2321
import org.junit.Test;
2422
import org.springframework.core.env.ConfigurableEnvironment;
25-
import org.springframework.core.env.StandardEnvironment;
2623
import org.springframework.core.env.MutablePropertySources;
2724
import org.springframework.core.env.PropertySource;
25+
import org.springframework.core.env.StandardEnvironment;
26+
import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder;
27+
28+
import static org.hamcrest.CoreMatchers.*;
29+
import static org.junit.Assert.*;
2830

2931
/**
3032
* Unit tests for {@link StandardServletEnvironment}.
@@ -35,7 +37,9 @@
3537
public class StandardServletEnvironmentTests {
3638

3739
@Test
38-
public void propertySourceOrder() {
40+
public void propertySourceOrder() throws Exception {
41+
SimpleNamingContextBuilder.emptyActivatedContextBuilder();
42+
3943
ConfigurableEnvironment env = new StandardServletEnvironment();
4044
MutablePropertySources sources = env.getPropertySources();
4145

0 commit comments

Comments
 (0)