mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-19 10:08:22 +08:00
Extract config classes to TestConfiguration
This commit is contained in:
@@ -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 {
|
||||
}
|
Reference in New Issue
Block a user