mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-19 18:22:26 +08:00
Add integration test
This commit is contained in:
15
app.groovy
15
app.groovy
@@ -200,21 +200,12 @@ class MainController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
import reactor.core.Reactor
|
@EnableReactor
|
||||||
import reactor.function.Consumer
|
|
||||||
import reactor.event.selector.Selectors
|
|
||||||
import reactor.event.Event
|
|
||||||
@Grab("reactor-core")
|
|
||||||
class ReactorConfiguration {
|
class ReactorConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public reactor.core.Environment reactorEnvironment() {
|
public Reactor rootReactor(reactor.core.Environment reactorEnvironment) {
|
||||||
return new reactor.core.Environment(); // TODO: use Spring Environment to configure?
|
return reactorEnvironment.getRootReactor();
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Reactor rootReactor() {
|
|
||||||
return reactorEnvironment().getRootReactor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
20
test/integration.groovy
Normal file
20
test/integration.groovy
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
@Grab("spring-boot-starter-test")
|
||||||
|
|
||||||
|
@SpringApplicationConfiguration(classes=app.MainController)
|
||||||
|
@WebAppConfiguration
|
||||||
|
@IntegrationTest('server.port:0')
|
||||||
|
@DirtiesContext
|
||||||
|
class IntegrationTests {
|
||||||
|
|
||||||
|
@Value('${local.server.port}')
|
||||||
|
int port
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testHome() {
|
||||||
|
String body = new TestRestTemplate().getForObject('http://localhost:' + port, String)
|
||||||
|
assertTrue('Wrong body:\n' + body, body.contains('action="/starter.zip"'))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user