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.

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.