@@ -0,0 +1,1980 @@
+package org.sagebionetworks.web.unitclient.presenter;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.verifyNoMoreInteractions;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.sagebionetworks.web.client.place.MapPlace;%0Aimport org.sagebionetworks.web.client.presenter.MapPresenter;%0Aimport org.sagebionetworks.web.client.view.MapView;%0Aimport org.sagebionetworks.web.client.widget.googlemap.GoogleMap;%0Aimport org.sagebionetworks.web.client.widget.team.TeamBadge;%0A%0Aimport com.google.gwt.user.client.ui.Widget;%0A%0Apublic class MapPresenterTest %7B%0A%09MapPresenter presenter;%0A%09@Mock%0A%09MapView mockView;%0A%09@Mock%0A%09GoogleMap mockMap;%0A%09@Mock%0A%09TeamBadge mockTeamBadge;%0A%09@Mock%0A%09MapPlace mockPlace;%0A%09%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%09MockitoAnnotations.initMocks(this);%0A%09%09presenter = new MapPresenter(mockView, mockMap, mockTeamBadge);%0A%09%7D%0A%0A%09@Test%0A%09public void testConstructor() %7B%0A%09%09verify(mockView).setPresenter(presenter);%0A%09%09verify(mockView).setMap(any(Widget.class));%0A%09%09verify(mockView).setTeamBadge(any(Widget.class));%0A%09%7D%0A%09%0A%09@Test%0A%09public void testSetPlaceAllUsers() %7B%0A%09%09when(mockPlace.getTeamId()).thenReturn(MapPresenter.ALL_USERS);%0A%09%09presenter.setPlace(mockPlace);%0A%09%09verify(mockMap).configure();%0A%09%09verify(mockView).setAllUsersTitleVisible(true);%0A%09%09verify(mockView).setTeamBadgeVisible(false);%0A%09%09%0A%09%09//besides setting the team badge in the view, there should be no interactions%0A%09%09verify(mockTeamBadge).asWidget();%0A%09%09verifyNoMoreInteractions(mockTeamBadge);%0A%09%7D%0A%0A%09@Test%0A%09public void testSetPlaceTeam() %7B%0A%09%09String teamId = %2212345%22;%0A%09%09when(mockPlace.getTeamId()).thenReturn(teamId);%0A%09%09presenter.setPlace(mockPlace);%0A%09%09verify(mockMap).configure(teamId);%0A%09%09verify(mockView).setAllUsersTitleVisible(false);%0A%09%09verify(mockView).setTeamBadgeVisible(true);%0A%09%09verify(mockTeamBadge).configure(teamId);%0A%09%7D%0A%7D%0A

add test