From 4999d41145b5b491aea0723932f2aa60dc49f224 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 23 May 2014 11:05:13 +0100 Subject: [PATCH] Add test for servletMapping() --- .../web/ServerPropertiesTests.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index ef091d31e40..53e6148d9a5 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -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 map = new HashMap();