I have a Spring 3.2 MVC application and am using the Spring MVC test framework to test GET and POST requests on the actions of my controllers. I am using Mockito to mock the
If on SpringBoot use Springs own @MockBean. - as the docks say:
Any existing single bean of the same type defined in the context will be replaced by the mock. If no existing bean is defined a new one will be added.
@RunWith(SpringRunner.class)
public class ExampleTests {
@MockBean
private ExampleService service;