### Question:
DirectionsRenderer extends JavascriptObject { public void setMap(GoogleMap map){ if( map == null ) { getJSObject().eval(getVariableName()+".setMap(null);"); } else { getJSObject().eval(getVariableName()+".setMap("+map.getVariableName()+");"); } } DirectionsRenderer();  DirectionsRenderer(JSObject type);  DirectionsRenderer(boolean drag, GoogleMap map, DirectionsPane panel);  DirectionsRenderer(boolean drag, GoogleMap map, DirectionsPane panel, String strokeColor); void setMap(GoogleMap map); void clearDirections(); void setOptions(String options); void setPanel(DirectionsPane panel); int getRoutesCount(); void setRouteIndex(int index); @Override String toString();  }### Answer:
@Test public void testSetMap_WithMap() { doReturn(mockJSObject).when(testRenderer).getJSObject(); doReturn("MyVariable").when(testRenderer).getVariableName(); when(mockMap.getVariableName()).thenReturn("MyMap"); testRenderer.setMap(mockMap); verify(mockJSObject).eval("MyVariable.setMap(MyMap);"); }
@Test public void testSetMap_NullMap() { doReturn(mockJSObject).when(testRenderer).getJSObject(); doReturn("MyVariable").when(testRenderer).getVariableName(); testRenderer.setMap(null); verify(mockJSObject).eval("MyVariable.setMap(null);"); }