Update the samples to use @WebIntegrationTest and randomPort=true

Closes gh-4294
Closes gh-4271
This commit is contained in:
Huang YunKun
2015-10-24 03:46:49 +00:00
committed by Andy Wilkinson
parent acf6f2193b
commit 1c5e445554
59 changed files with 118 additions and 234 deletions

View File

@@ -18,6 +18,7 @@ package sample.tomcat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.WebIntegrationTest;
import sample.tomcat.NonAutoConfigurationSampleTomcatApplicationTests.NonAutoConfigurationSampleTomcatApplication;
import sample.tomcat.service.HelloWorldService;
import sample.tomcat.web.SampleController;
@@ -30,7 +31,6 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.context.annotation.ComponentScan;
@@ -40,7 +40,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.assertEquals;
@@ -51,8 +50,7 @@ import static org.junit.Assert.assertEquals;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(NonAutoConfigurationSampleTomcatApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port=0")
@WebIntegrationTest(randomPort = true)
@DirtiesContext
public class NonAutoConfigurationSampleTomcatApplicationTests {