Integration testing

Let's shift our focus to writing an integration test and then add a method to BasicControllerIT, as shown in the following code snippet:

    @Test
fun `GET welcome-with-object returns "Hello World"`() {
// When
val body = restTemplate.getForObject("/welcome-with-object",
WelcomeBean::class.java)
// Then
assertThat(body.message, containsString("Hello World"));
}

This method is similar to the earlier integration test, except that we are asserting for a substring in the assertThat method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset