Browse Source

Add test for servletMapping()

pull/944/head
Dave Syer 12 years ago
parent
commit
4999d41145
  1. 20
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

20
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

@ -58,6 +58,26 @@ public class ServerPropertiesTests { @@ -58,6 +58,26 @@ public class ServerPropertiesTests {
assertEquals(9000, this.properties.getPort().intValue());
}
@Test
public void testServletPathAsMapping() throws Exception {
RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
binder.bind(new MutablePropertyValues(Collections.singletonMap(
"server.servletPath", "/foo/*")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals("/foo/*", this.properties.getServletMapping());
assertEquals("/foo", this.properties.getServletPrefix());
}
@Test
public void testServletPathAsPrefix() throws Exception {
RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
binder.bind(new MutablePropertyValues(Collections.singletonMap(
"server.servletPath", "/foo")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals("/foo/*", this.properties.getServletMapping());
assertEquals("/foo", this.properties.getServletPrefix());
}
@Test
public void testTomcatBinding() throws Exception {
Map<String, String> map = new HashMap<String, String>();

Loading…
Cancel
Save