When calling Mockito.verify (view) .showNoContent (), the error was Wanted but not invoked: view.showNoContent (); -> at kz.retail.buyer.ui.favorite.FavoritePresenterTest.loadFavoriteStoresFailed (FavoritePresenterTest.java:187) Actually there were zero interactions with this mock.
@Mock private FavoriteContract.View view; @Mock private BaseApp app; @Before public void setUp() throws Exception{ MockitoAnnotations.initMocks(this); presenter = new FavoritePresenter(view, app); } @Test public void loadFavoriteStoresFailed(){ when(app.getApiService()).thenReturn(service); when(service.getFavoriteStoreList(anyString())).thenReturn(Observable.error(new Exception())); presenter.loadFavoriteStore(); Mockito.verify(view).showNoContent(); }