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(); } 
  • The message indicates that the method you are expecting has not been called. That is, the test failed - eugeneek
  • why not be called? - Mr.Baga
  • Check the code you are testing. - eugeneek

0