@Test
public void getVirtualDeviceNameIsNull() throws Exception {

  // Arrange
  IDevice ddmlibDevice = Mockito.mock(IDevice.class);
  Mockito.when(ddmlibDevice.isOnline()).thenReturn(true);
  Mockito.when(ddmlibDevice.isEmulator()).thenReturn(true);
  Mockito.when(ddmlibDevice.getSerialNumber()).thenReturn("emulator-5554");
  // noinspection UnstableApiUsage
  Mockito.when(myAndroidDebugBridge.getConnectedDevices()).thenReturn(Futures.immediateFuture(Collections.singletonList(ddmlibDevice)));
  AndroidDevice androidDevice = Mockito.mock(AndroidDevice.class);
  AsyncSupplier task = new ConnectedDevicesTask(myAndroidDebugBridge, false, null, MoreExecutors.directExecutor(), d -> androidDevice);
  // Act
  Future connectedDevices = task.get();
  // Assert
  Object connectedDevice = new ConnectedDevice.Builder()
    .setName("Virtual Device")
    .setKey(new Key("emulator-5554"))
    .setAndroidDevice(androidDevice)
    .build();
  assertEquals(Collections.singletonList(connectedDevice), connectedDevices.get(1, TimeUnit.SECONDS));
}