@ -16,6 +16,9 @@
package org.springframework.boot.actuate.endpoint.mvc ;
package org.springframework.boot.actuate.endpoint.mvc ;
import java.util.HashMap ;
import java.util.Map ;
import org.junit.Before ;
import org.junit.Before ;
import org.junit.Test ;
import org.junit.Test ;
import org.junit.runner.RunWith ;
import org.junit.runner.RunWith ;
@ -34,6 +37,8 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.context.annotation.Import ;
import org.springframework.context.annotation.Import ;
import org.springframework.core.env.ConfigurableEnvironment ;
import org.springframework.core.env.MapPropertySource ;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner ;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner ;
import org.springframework.test.context.web.WebAppConfiguration ;
import org.springframework.test.context.web.WebAppConfiguration ;
import org.springframework.test.web.servlet.MockMvc ;
import org.springframework.test.web.servlet.MockMvc ;
@ -89,6 +94,10 @@ public class EnvironmentMvcEndpointTests {
@Test
@Test
public void regex ( ) throws Exception {
public void regex ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
map . put ( "food" , null ) ;
( ( ConfigurableEnvironment ) this . context . getEnvironment ( ) ) . getPropertySources ( )
. addFirst ( new MapPropertySource ( "null-value" , map ) ) ;
this . mvc . perform ( get ( "/env/foo.*" ) ) . andExpect ( status ( ) . isOk ( ) )
this . mvc . perform ( get ( "/env/foo.*" ) ) . andExpect ( status ( ) . isOk ( ) )
. andExpect ( content ( ) . string ( containsString ( "\"foo\":\"bar\"" ) ) )
. andExpect ( content ( ) . string ( containsString ( "\"foo\":\"bar\"" ) ) )
. andExpect ( content ( ) . string ( containsString ( "\"fool\":\"baz\"" ) ) ) ;
. andExpect ( content ( ) . string ( containsString ( "\"fool\":\"baz\"" ) ) ) ;