### Question:
MainPresenter { void onItemClicked(String item) { if (mainView != null) { mainView.showMessage(String.format("%s clicked", item)); } } MainPresenter(MainView mainView, FindItemsInteractor findItemsInteractor); void onFinished(List<String> items); MainView getMainView();  }### Answer:
@Test public void checkIfShowsMessageOnItemClick() { presenter.onItemClicked(1); verify(view, times(1)).showMessage(anyString()); }
@Test public void checkIfRightMessageIsDisplayed() { ArgumentCaptor<String> captor = forClass(String.class); presenter.onItemClicked(1); verify(view, times(1)).showMessage(captor.capture()); assertThat(captor.getValue(), is("Position 2 clicked")); }