### Question:
MainViewModel extends AndroidViewModel { void sendColorMsg(MeshId targetMeshId, Colour msgColor) { try { if (targetMeshId != null) { String payload = targetMeshId.toString() + ":" + msgColor.toString(); rmConnector.sendDataReliable(targetMeshId, payload); } } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while sending data, with message: " + sde.getMessage()); liveDataNotification.setValue(sde.getMessage()); } catch (RightMeshRuntimeException.RightMeshLicenseException le) { Log.e(TAG, le.getMessage()); liveDataNotification.setValue(le.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "Unable to find next hop to peer, with message: " + rme.getMessage()); liveDataNotification.setValue(rme.getMessage()); } } MainViewModel(@NonNull Application application); void setRightMeshConnector(RightMeshConnector rmConnector);  }### Answer:
@Test public void sendColorMsg_nullTargetMeshId() throws RightMeshException { MeshId targetId = null; Colour msgColor = Colour.RED; String payload = String.valueOf(targetId) + ":" + msgColor; spyViewModel.sendColorMsg(targetId, msgColor); verify(rightMeshConnector, never()).sendDataReliable(targetId, payload); verify(spyViewModel).sendColorMsg(targetId, msgColor); }
@Test public void sendColorMsg_targetMeshId() throws RightMeshException { MeshId targetId = mockMeshId; Colour msgColor = Colour.RED; String payload = String.valueOf(targetId) + ":" + msgColor; spyViewModel.sendColorMsg(targetId, msgColor); verify(rightMeshConnector).sendDataReliable(targetId, payload); verify(spyViewModel).sendColorMsg(targetId, msgColor); }