spring-boot/spring-boot-cli/test-samples/integration_auto.groovy
Stephane Nicoll 7c0c953f81 Add value alias for SpringApplicationConfiguration
Given that Spring Boot uses java config accross the board, a new `value`
attribute is now aliased to the existing `classes` attribute such that
one could write the following:

@SpringApplicationConfiguration(MyConfig.class)
public class MyTest {}

Closes gh-3635
2015-08-19 17:09:34 +02:00

21 lines
407 B
Groovy

@SpringApplicationConfiguration(Application)
@IntegrationTest('server.port:0')
@WebAppConfiguration
@DirtiesContext
class RestTests {
@Value('${local.server.port}')
int port
@Test
void testHome() {
assertEquals('Hello', new TestRestTemplate().getForObject('http://localhost:' + port, String))
}
@RestController
static class Application {
@RequestMapping('/')
String hello() { 'Hello' }
}
}