@Test public void redirectContextRootCanBeConfigured() throws Exception { Map<String, String> map = new HashMap<String, String>(); map.put("server.tomcat.redirect-context-root", "false"); bindProperties(map); ServerProperties.Tomcat tomcat = this.properties.getTomcat(); assertThat(tomcat.getRedirectContextRoot()).isEqualTo(false); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); this.properties.customize(container); Context context = mock(Context.class); for (TomcatContextCustomizer customizer : container.getTomcatContextCustomizers()) { customizer.customize(context); } verify(context).setMapperContextRootRedirectEnabled(false); }
@Test public void redirectContextRootIsNotConfiguredByDefault() throws Exception { bindProperties(new HashMap<String, String>()); ServerProperties.Tomcat tomcat = this.properties.getTomcat(); assertThat(tomcat.getRedirectContextRoot()).isNull(); }