MapReadyInitializer { void onMapReady(MapView mapView, MapzenMapHttpHandler mapzenMapHttpHandler, OnMapReadyCallback callback, MapDataManager mapDataManager, MapStateManager mapStateManager, SceneUpdateManager sceneUpdateManager, Locale locale, BitmapMarkerManager bitmapMarkerManager, ImportYamlGenerator yamlGenerator) { MapController mapController = mapView.getTangramMapView().getMap(null); mapController.setSceneLoadListener(null); mapController.setHttpHandler(mapzenMapHttpHandler.httpHandler()); MapzenManager mapzenManager = MapzenManager.instance(mapView.getContext()); bitmapMarkerManager.setMapController(mapController); callback.onMapReady( new MapzenMap(mapView, mapController, new OverlayManager(mapView, mapController, mapDataManager, mapStateManager), mapStateManager, new LabelPickHandler(mapView), bitmapMarkerManager, sceneUpdateManager, locale, mapzenManager, yamlGenerator)); }    }
@Test public void onMapReady_shouldSetMapControllerSceneLoadListenerNull() throws Exception { MapView mapView = mock(MapView.class); Context context = mock(Context.class); when(mapView.getContext()).thenReturn(context); when(context.getApplicationContext()).thenReturn(mock(Context.class)); TangramMapView tangramMapView = mock(TangramMapView.class); MapController mapController = mock(MapController.class); when(mapView.getTangramMapView()).thenReturn(tangramMapView); when(tangramMapView.getMap(any(MapController.SceneLoadListener.class))).thenReturn( mapController); initializer.onMapReady(mapView, mock(MapzenMapHttpHandler.class), mock(OnMapReadyCallback.class), mock(MapDataManager.class), mock(MapStateManager.class), mock(SceneUpdateManager.class), new Locale("en_us"), mock(BitmapMarkerManager.class), mock(ImportYamlGenerator.class)); verify(mapController).setSceneLoadListener(null); }
@Test public void onMapReady_shouldSetMapControllerHttpHandler() throws Exception { MapView mapView = mock(MapView.class); Context context = mock(Context.class); when(mapView.getContext()).thenReturn(context); when(context.getApplicationContext()).thenReturn(mock(Context.class)); TangramMapView tangramMapView = mock(TangramMapView.class); MapController mapController = mock(MapController.class); when(mapView.getTangramMapView()).thenReturn(tangramMapView); when(tangramMapView.getMap(any(MapController.SceneLoadListener.class))).thenReturn( mapController); MapzenMapHttpHandler mapzenHttpHandler = mock(MapzenMapHttpHandler.class); HttpHandler httpHandler = mock(HttpHandler.class); when(mapzenHttpHandler.httpHandler()).thenReturn(httpHandler); initializer.onMapReady(mapView, mapzenHttpHandler, mock(OnMapReadyCallback.class), mock(MapDataManager.class), mock(MapStateManager.class), mock(SceneUpdateManager.class), new Locale("en_us"), mock(BitmapMarkerManager.class), mock(ImportYamlGenerator.class)); verify(mapController).setHttpHandler(httpHandler); }
@Test public void onMapReady_shouldCallOnMapReady() throws Exception { MapView mapView = mock(MapView.class); Context context = mock(Context.class); when(mapView.getContext()).thenReturn(context); when(context.getApplicationContext()).thenReturn(mock(Context.class)); TangramMapView tangramMapView = mock(TangramMapView.class); MapController mapController = mock(MapController.class); when(mapView.getTangramMapView()).thenReturn(tangramMapView); when(tangramMapView.getMap(any(MapController.SceneLoadListener.class))).thenReturn( mapController); OnMapReadyCallback callback = mock(OnMapReadyCallback.class); initializer.onMapReady(mapView, mock(MapzenMapHttpHandler.class), callback, mock(MapDataManager.class), mock(MapStateManager.class), mock(SceneUpdateManager.class), new Locale("en_us"), mock(BitmapMarkerManager.class), mock(ImportYamlGenerator.class)); verify(callback).onMapReady(any(MapzenMap.class)); }