@Test
public void testMonitorTooltip() {

  // Set Session to enable Energy monitor tooltip.
  myProfilerService.addSession(SESSION_O, SESSION_O_METADATA);
  myTimer.tick(FakeTimer.ONE_SECOND_IN_NS);
  myProfilers.getSessionsManager().setSession(SESSION_O);
  myUi.layout();
  assertThat(myProfilers.getStage()).isInstanceOf(StudioMonitorStage.class);
  StudioMonitorStage stage = (StudioMonitorStage)myProfilers.getStage();
  List<Point> points = new TreeWalker(myView.getComponent()).descendantStream()
    .filter(d -> d instanceof LineChart)
    .map(c -> myUi.getPosition(c))
    .collect(Collectors.toList());
  // Test that we have the expected number of monitors
  assertThat(points.size()).isEqualTo(4);
  // cpu monitor tooltip
  myUi.mouse.moveTo(points.get(0).x + 1, points.get(0).y + 1);
  assertThat(stage.getTooltip()).isInstanceOf(CpuMonitorTooltip.class);
  ProfilerMonitor cpuMonitor = ((CpuMonitorTooltip)stage.getTooltip()).getMonitor();
  stage.getMonitors().forEach(
    monitor -> Truth.assertWithMessage("Only the CPU Monitor should be focused.")
      .that(monitor.isFocused()).isEqualTo(monitor == cpuMonitor));
  // memory monitor tooltip
  myUi.mouse.moveTo(points.get(1).x + 1, points.get(1).y + 1);
  assertThat(stage.getTooltip()).isInstanceOf(MemoryMonitorTooltip.class);
  ProfilerMonitor memoryMonitor = ((MemoryMonitorTooltip)stage.getTooltip()).getMonitor();
  stage.getMonitors().forEach(
    monitor -> Truth.assertWithMessage("Only the Memory Monitor should be focused.")
      .that(monitor.isFocused()).isEqualTo(monitor == memoryMonitor));
  // network monitor tooltip
  myUi.mouse.moveTo(points.get(2).x + 1, points.get(2).y + 1);
  assertThat(stage.getTooltip()).isInstanceOf(NetworkMonitorTooltip.class);
  ProfilerMonitor networMonitor = ((NetworkMonitorTooltip)stage.getTooltip()).getMonitor();
  stage.getMonitors().forEach(
    monitor -> Truth.assertWithMessage("Only the Network Monitor should be focused.")
      .that(monitor.isFocused()).isEqualTo(monitor == networMonitor));
  // energy monitor tooltip
  myUi.mouse.moveTo(points.get(3).x + 1, points.get(3).y + 1);
  assertThat(stage.getTooltip()).isInstanceOf(EnergyMonitorTooltip.class);
  ProfilerMonitor energyMonitor = ((EnergyMonitorTooltip)stage.getTooltip()).getMonitor();
  stage.getMonitors().forEach(
    monitor -> Truth.assertWithMessage("Only the Energy Monitor should be focused.")
      .that(monitor.isFocused()).isEqualTo(monitor == energyMonitor));
  // no tooltip
  myUi.mouse.moveTo(0, 0);
  assertThat(stage.getTooltip()).isNull();
  stage.getMonitors().forEach(monitor -> Truth.assertWithMessage("No monitor should be focused.").that(monitor.isFocused()).isFalse());
}