Add test for servletMapping()

This commit is contained in:
Dave Syer 2014-05-23 11:05:13 +01:00
parent 96a0d672af
commit 4999d41145
1 changed files with 20 additions and 0 deletions

View File

@ -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>();