### Question:
QuestionsPresenter implements QuestionsActivityContract.Presenter { @Override public void addPoiNameToTextview() { List<OsmObject> poiList = PoiList.getInstance().getPoiList(); if (poiList.size() != 0) { String poiType = poiList.get(0).getType(); PoiContract listOfQuestions = PoiTypes.getPoiType(poiType); listOfQuestions.shuffleQuestions(); if (preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM)) { view.setViewPager(poiList.get(0), listOfQuestions); if (poiList.size() == 1) { view.makeTextViewInvisible(); } else { view.setTextviewText(poiList.get(0).getName()); } } else { view.startNewActivity(); } } } QuestionsPresenter(QuestionsActivityContract.View view, SourceContract.Preferences preferences); @Override void addPoiNameToTextview(); @Override void assessIntentData(URI uri); @Override void savePoiList(); @Override void restorePoiList();  }### Answer:
@Test public void addPoiNameToTextViewTestSinglePoiInList() { List<OsmObject> poiList = new ArrayList<>(); poiList.add(new OsmObject(1, "node", "", "restaurant", 1, 1, 1)); PoiList.getInstance().setPoiList(poiList); when(preferences.getBooleanPreference(anyString())).thenReturn(true); questionsPresenter.addPoiNameToTextview(); verify(view).makeTextViewInvisible(); }
@Test public void addPoiNameToTextViewTestMultiplePoiInList() { List<OsmObject> poiList = new ArrayList<>(); poiList.add(new OsmObject(1, "node", "Kitchen", "restaurant", 1, 1, 1)); poiList.add(new OsmObject(1, "node", "", "restaurant", 1, 1, 1)); PoiList.getInstance().setPoiList(poiList); when(preferences.getBooleanPreference(anyString())).thenReturn(true); questionsPresenter.addPoiNameToTextview(); verify(view).setTextviewText("Kitchen"); }
@Test public void addPoiNameToTextViewTestNotLoggedIn() { List<OsmObject> poiList = new ArrayList<>(); poiList.add(new OsmObject(1, "node", "Kitchen", "restaurant", 1, 1, 1)); poiList.add(new OsmObject(1, "node", "", "restaurant", 1, 1, 1)); PoiList.getInstance().setPoiList(poiList); when(preferences.getBooleanPreference(anyString())).thenReturn(false); questionsPresenter.addPoiNameToTextview(); verify(view).startNewActivity(); }