August 2017
Beginner to intermediate
370 pages
8h 37m
English
Let's understand some of the following concepts before we get to look at the source codes for controllers and the corresponding unit tests written using JUnit 5:
private MockMvc mockMvc; @MockBean private UserService userService; @BeforeEach public void setUp() throws Exception { this.mockMvc = MockMvcBuilders.standaloneSetup(new UserAccountController(this.userService)).build(); }
In the preceding code, UserService, a dependency within the controller, is mocked using the @MockBean ...
Read now
Unlock full access