Skip to content

Instantly share code, notes, and snippets.

@lucapiccinelli
Created May 26, 2020 06:20
Show Gist options
  • Save lucapiccinelli/43d69e6c96801c0b8b804a18f2c9d4bd to your computer and use it in GitHub Desktop.
Save lucapiccinelli/43d69e6c96801c0b8b804a18f2c9d4bd to your computer and use it in GitHub Desktop.
A test that tests the state preservation
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [MainApplication::class])
class HelloTests(@Autowired val restTemplate: TestRestTemplate) {
@Test
fun `GIVEN springboot in certain state WHEN a restart happens THEN it should preserve the state`(){
restTemplate.getForObject<String>("/hello") shouldBe "Ok 0"
restart()
restTemplate.getForObject<String>("/hello") shouldBe "Ok 1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment