Difference between @Mock, @MockBean and Mockito.mock()
Plain Mockito library import org.mockito.Mock; … @Mock MyService myservice; and import org.mockito.Mockito; … MyService myservice = Mockito.mock(MyService.class); come from the Mockito library and are functionally equivalent. They allow to mock a class or an interface and to record and verify behaviors on it. The way using annotation is shorter, so preferable and often preferred. Note … Read more