mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
22 lines
390 B
Groovy
22 lines
390 B
Groovy
package com.example
|
|
|
|
@SpringBootApplication
|
|
@SpringBootTest(classes=RestTests, webEnvironment=WebEnvironment.RANDOM_PORT)
|
|
class RestTests {
|
|
|
|
@Autowired
|
|
TestRestTemplate testRestTemplate
|
|
|
|
@Test
|
|
void testHome() {
|
|
assertEquals('Hello', testRestTemplate.getForObject('/', String))
|
|
}
|
|
|
|
@RestController
|
|
static class Application {
|
|
@RequestMapping('/')
|
|
String hello() { 'Hello' }
|
|
}
|
|
|
|
}
|