### Question:
InfoWindow { @NonNull InfoWindow open(@NonNull MapView mapView, Marker boundMarker, @NonNull LatLng position, int offsetX, int offsetY) { setBoundMarker(boundMarker); MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT, MapView.LayoutParams.WRAP_CONTENT); MapboxMap mapboxMap = this.mapboxMap.get(); View view = this.view.get(); if (view != null && mapboxMap != null) { view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); markerHeightOffset = offsetY; markerWidthOffset = -offsetX; coordinates = mapboxMap.getProjection().toScreenLocation(position); float x = coordinates.x - (view.getMeasuredWidth() / 2) + offsetX; float y = coordinates.y - view.getMeasuredHeight() + offsetY; if (view instanceof BubbleLayout) { Resources resources = mapView.getContext().getResources(); float rightSideInfowWindow = x + view.getMeasuredWidth(); float leftSideInfoWindow = x; final float mapRight = mapView.getRight(); final float mapLeft = mapView.getLeft(); float marginHorizontal = resources.getDimension(R.dimen.mapbox_infowindow_margin); float tipViewOffset = resources.getDimension(R.dimen.mapbox_infowindow_tipview_width) / 2; float tipViewMarginLeft = view.getMeasuredWidth() / 2 - tipViewOffset; boolean outOfBoundsLeft = false; boolean outOfBoundsRight = false; if (coordinates.x >= 0 && coordinates.x <= mapView.getWidth() && coordinates.y >= 0 && coordinates.y <= mapView.getHeight()) { if (rightSideInfowWindow > mapRight) { outOfBoundsRight = true; x -= rightSideInfowWindow - mapRight; tipViewMarginLeft += rightSideInfowWindow - mapRight + tipViewOffset; rightSideInfowWindow = x + view.getMeasuredWidth(); } if (leftSideInfoWindow < mapLeft) { outOfBoundsLeft = true; x += mapLeft - leftSideInfoWindow; tipViewMarginLeft -= mapLeft - leftSideInfoWindow + tipViewOffset; leftSideInfoWindow = x; } if (outOfBoundsRight && mapRight - rightSideInfowWindow < marginHorizontal) { x -= marginHorizontal - (mapRight - rightSideInfowWindow); tipViewMarginLeft += marginHorizontal - (mapRight - rightSideInfowWindow) - tipViewOffset; leftSideInfoWindow = x; } if (outOfBoundsLeft && leftSideInfoWindow - mapLeft < marginHorizontal) { x += marginHorizontal - (leftSideInfoWindow - mapLeft); tipViewMarginLeft -= (marginHorizontal - (leftSideInfoWindow - mapLeft)) - tipViewOffset; } } ((BubbleLayout) view).setArrowPosition(tipViewMarginLeft); } view.setX(x); view.setY(y); viewWidthOffset = x - coordinates.x - offsetX; viewHeightOffset = -view.getMeasuredHeight() + offsetY; close(); mapView.addView(view, lp); isVisible = true; } return this; } InfoWindow(MapView mapView, int layoutResId, MapboxMap mapboxMap);   InfoWindow(@NonNull View view, MapboxMap mapboxMap); void update(); @Nullable View getView();  }### Answer:
@Test public void testOpen() { LatLng latLng = new LatLng(0, 0); Projection projection = mock(Projection.class); when(mMapboxMap.getProjection()).thenReturn(projection); when(projection.toScreenLocation(latLng)).thenReturn(new PointF(0, 0)); InfoWindow infoWindow = new InfoWindow(mMapView, mMapboxMap); infoWindow.open(mMapView, new MarkerOptions().position(new LatLng()).getMarker(), latLng, 0, 0); assertEquals("infowindow should not be visible", true, infoWindow.isVisible()); }