Integration testing

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

    @Test
public void welcomeWithObject() throws Exception {
ResponseEntity<String> response =
template.getForEntity(createURL("/welcome-with-object"),
String.class);
assertThat(response.getBody(),
containsString("Hello World"));
}

This method is similar to the earlier integration test except that we are asserting for a sub-string using the String method.

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

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