Files
initializr/test/integration.groovy

44 lines
1.3 KiB
Groovy
Raw Normal View History

2014-05-28 17:26:53 +01:00
package test
@SpringApplicationConfiguration(classes=TestConfiguration)
2014-05-28 17:26:53 +01:00
@WebAppConfiguration
@IntegrationTest('server.port:0')
@DirtiesContext
class IntegrationTests {
@Value('${local.server.port}')
int port
@Test
void homeIsForm() {
2014-05-28 17:26:53 +01:00
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
assertTrue('Wrong body:\n' + body, body.contains('action="/starter.zip"'))
}
2014-05-28 19:25:35 +01:00
@Test
void infoHasExternalProperties() {
String body = new TestRestTemplate().getForObject('http://localhost:' + port + '/info', String)
assertTrue('Wrong body:\n' + body, body.contains('"project"'))
}
@Test
void homeHasWebStyle() {
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
assertTrue('Wrong body:\n' + body, body.contains('name="style" value="web"'))
}
@Test
void downloadStarter() {
byte[] body = new TestRestTemplate().getForObject('http://localhost:' + port + 'starter.zip', byte[])
assertNotNull(body)
assertTrue(body.length>100)
}
}
// CLI compliled classes are not @ComponentScannable so we have to create
// an explicit configuration for the test
@Configuration
@Import([app.MainController, app.Projects, app.TemporaryFileCleaner])
class TestConfiguration {
2014-05-28 17:26:53 +01:00
}