Add test for customize container factory

This commit is contained in:
Dave Syer 2013-11-29 17:26:17 +00:00
parent 4a60e3ccf6
commit c03a06b52d

View File

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