January 2019
Intermediate to advanced
378 pages
11h 35m
English
Tests that involves the validation of individual operations are unit tests. In our investor services API examples in Chapter 4, Advanced RESTful API Patterns, we covered numerous unit test cases, and the following is one of the sample code snippets of a specific unit test case that validates getting all the investors from the API:
@Test
public void fetchAllInvestors() throws Exception{
RequestBuilder requestBuilder =
MockMvcRequestBuilders.get(
"/investors").accept(
MediaType.APPLICATION_JSON);
MvcResult result =
mockMvc.perform(requestBuilder).andReturn();
MockHttpServletResponse response =
result.getResponse();
}
Read now
Unlock full access