@@ -0,0 +1,1862 @@
+package io.github.plastix.forage.ui.map;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.List;%0A%0Aimport io.github.plastix.forage.data.local.DatabaseInteractor;%0Aimport io.github.plastix.forage.data.local.model.Cache;%0Aimport rx.Single;%0A%0Aimport static java.util.Arrays.asList;%0Aimport static org.mockito.Matchers.anyListOf;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.only;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class MapPresenterTest %7B%0A%0A    private MapPresenter mapPresenter;%0A    private DatabaseInteractor databaseInteractor;%0A    private MapFragView view;%0A%0A    @Before%0A    public void beforeEachTest() %7B%0A        view = mock(MapFragView.class);%0A        databaseInteractor = mock(DatabaseInteractor.class);%0A        mapPresenter = new MapPresenter(databaseInteractor);%0A        mapPresenter.setView(view);%0A    %7D%0A%0A    @Test%0A    public void onDestroy_shouldCallDatabaseInteractorDestroy() %7B%0A        mapPresenter.onDestroy();%0A        verify(databaseInteractor, only()).onDestroy();%0A    %7D%0A%0A    @Test%0A    public void getGeocaches_shouldCallViewPopulateMap() %7B%0A        List%3CCache%3E caches = asList(mock(Cache.class), mock(Cache.class));%0A        when(databaseInteractor.getGeocaches()).thenReturn(Single.just(caches));%0A%0A        mapPresenter.getGeocaches();%0A%0A        verify(databaseInteractor, only()).getGeocaches();%0A        verify(view, only()).populateMap(caches);%0A    %7D%0A%0A    @Test%0A    public void getGeocaches_errorDoesNothing() %7B%0A        when(databaseInteractor.getGeocaches()).%0A                thenReturn(Single.%3CList%3CCache%3E%3Eerror(new Throwable(%22Error%22)));%0A%0A        mapPresenter.getGeocaches();%0A%0A        verify(databaseInteractor, only()).getGeocaches();%0A        verify(view, never()).populateMap(anyListOf(Cache.class));%0A    %7D%0A%7D%0A

Add MapPresenter unit tests