From c03a06b52d3da3e97470a3097f6f4a7430294e7f Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 29 Nov 2013 17:26:17 +0000 Subject: [PATCH] Add test for customize container factory --- .../web/ServerPropertiesTests.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 96f6641275..1737446525 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 @@ -24,9 +24,12 @@ import java.util.Map; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; import org.springframework.boot.bind.RelaxedDataBinder; +import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainerFactory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; /** * Tests for {@link ServerProperties}. @@ -68,6 +71,19 @@ public class ServerPropertiesTests { .getProtocolHeader()); } - // FIXME test customize + @Test + public void testCustomizeTomcat() throws Exception { + ConfigurableEmbeddedServletContainerFactory factory = mock(ConfigurableEmbeddedServletContainerFactory.class); + this.properties.customize(factory); + verify(factory).setContextPath(""); + } + + @Test + public void testCustomizeTomcatPort() throws Exception { + ConfigurableEmbeddedServletContainerFactory factory = mock(ConfigurableEmbeddedServletContainerFactory.class); + this.properties.setPort(8080); + this.properties.customize(factory); + verify(factory).setPort(8080); + } }