From 0f8d00b3a8d6cb11d66bb9c41dca3afaf0dcb1eb Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 17 Mar 2014 12:36:13 +0000 Subject: [PATCH] Add javaodcs about @IntegrationTest to SpringApplicationContextLoader See gh-499 --- .../boot/test/IntegrationTest.java | 2 +- .../test/SpringApplicationContextLoader.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTest.java b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTest.java index 7b2b1bd7e0..9eeea3c552 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTest.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/IntegrationTest.java @@ -30,7 +30,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi /** * Test class annotation signifying that the tests are integration tests (and therefore - * require an application to startup "fully leaded" and listening on their normal ports). + * require an application to startup "fully leaded" and listening on its normal ports). * * @author Dave Syer */ diff --git a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java index 477750b158..28ec1a1fbe 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java @@ -44,11 +44,17 @@ import org.springframework.web.context.support.GenericWebApplicationContext; /** * A {@link ContextLoader} that can be used to test Spring Boot applications (those that - * normally startup using {@link SpringApplication}). Never starts an embedded web server, - * but detects the {@link WebAppConfiguration @WebAppConfiguration} annotation on the test - * class and only creates a web application context if it is present. Non-web features, - * like a repository layer, can be tested cleanly by simply not marking the test - * class @WebAppConfiguration. + * normally startup using {@link SpringApplication}). Normally never starts an embedded + * web server, but detects the {@link WebAppConfiguration @WebAppConfiguration} annotation + * on the test class and only creates a web application context if it is present. Non-web + * features, like a repository layer, can be tested cleanly by simply not marking + * the test class @WebAppConfiguration. + *

+ * If you want to start a web server, mark the test class as + * @WebAppConfiguration @IntegrationTest. This is useful for testing HTTP + * endpoints using {@link RestTemplates} (for instance), especially since you can + * @Autowired application context components into your test case to see the + * internal effects of HTTP requests directly. *

* If @ActiveProfiles are provided in the test class they will be used to * create the application context.