@Test
public void testCaptureInfoMessage_showsWhenLoadingCaptureWithMessage_hiddenWhenLoadingHeapDump() {

  MemoryProfilerStageView stageView = (MemoryProfilerStageView)myProfilersView.getStageView();
  Executor joiner = MoreExecutors.directExecutor();
  myMockLoader.setReturnImmediateFuture(true);
  // Load a fake capture with a non-null info message and verify the message is displayed.
  FakeCaptureObject fakeCapture =
    new FakeCaptureObject.Builder().setCaptureName("DUMMY_CAPTURE1").setStartTime(0).setEndTime(10).setInfoMessage("Foo").build();
  myStage.selectCaptureDuration(
    new CaptureDurationData<>(1, false, false, new CaptureEntry<>(new Object(), () -> fakeCapture)), joiner);
  // FakeCaptureObject's load() is a no-op, so force refresh here.
  myStage.refreshSelectedHeap();
  assertThat(stageView.getCaptureInfoMessage().isVisible()).isTrue();
  // Load a heap dump capture and verify the message is hidden.
  HeapDumpInfo heapDumpInfo = HeapDumpInfo.newBuilder()
    .setStartTime(TimeUnit.MICROSECONDS.toNanos(3))
    .setEndTime(TimeUnit.MICROSECONDS.toNanos(4))
    .build();
  HeapDumpCaptureObject heapDumpCapture = new HeapDumpCaptureObject(new ProfilerClient(getGrpcChannel().getName()),
                                                                    ProfilersTestData.SESSION_DATA,
                                                                    heapDumpInfo,
                                                                    null,
                                                                    myIdeProfilerServices.getFeatureTracker(),
                                                                    myStage);
  myStage.selectCaptureDuration(
    new CaptureDurationData<>(1, false, false, new CaptureEntry<>(new Object(), () -> heapDumpCapture)), joiner);
  assertThat(stageView.getCaptureInfoMessage().isVisible()).isFalse();
}