Extract config classes to TestConfiguration

This commit is contained in:
Dave Syer
2014-05-29 09:17:39 +01:00
parent c62acf515e
commit f0e07531cc
2 changed files with 79 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
package test
@SpringApplicationConfiguration(classes=app.MainController)
@SpringApplicationConfiguration(classes=TestConfiguration)
@WebAppConfiguration
@IntegrationTest('server.port:0')
@DirtiesContext
@@ -10,7 +10,7 @@ class IntegrationTests {
int port
@Test
void homeIsZipForm() {
void homeIsForm() {
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
assertTrue('Wrong body:\n' + body, body.contains('action="/starter.zip"'))
}
@@ -27,4 +27,18 @@ class IntegrationTests {
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 {
}