From 2667956a30960e6683e794d8bcf9860319af3ad8 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 20 Sep 2014 09:01:16 -0700 Subject: [PATCH] Initialize JNDI to fix failing Environment test Issue: SPR-12223 --- .../support/StandardServletEnvironmentTests.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java b/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java index 5c87bb7c05..494af3f9b1 100644 --- a/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java @@ -16,15 +16,17 @@ package org.springframework.web.context.support; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import javax.naming.NamingException; import org.junit.Test; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; +import org.springframework.core.env.StandardEnvironment; +import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; /** * Unit tests for {@link StandardServletEnvironment}. @@ -35,7 +37,9 @@ import org.springframework.core.env.PropertySource; public class StandardServletEnvironmentTests { @Test - public void propertySourceOrder() { + public void propertySourceOrder() throws Exception { + SimpleNamingContextBuilder.emptyActivatedContextBuilder(); + ConfigurableEnvironment env = new StandardServletEnvironment(); MutablePropertySources sources = env.getPropertySources();