MemoryProfilerStageView extends StageView<MemoryProfilerStage> { @VisibleForTesting @NotNull JLabel getCaptureInfoMessage() { return myCaptureInfoMessage; } MemoryProfilerStageView(@NotNull StudioProfilersView profilersView, @NotNull MemoryProfilerStage stage); @Override boolean isToolbarVisible(); @Override JComponent getToolbar(); @VisibleForTesting @NotNull Splitter getMainSplitter(); @VisibleForTesting @NotNull Splitter getChartCaptureSplitter(); @VisibleForTesting @NotNull JPanel getCapturePanel();  }
@Test public void testCaptureInfoMessage_showsWhenLoadingCaptureWithMessage_hiddenWhenLoadingHeapDump() { MemoryProfilerStageView stageView = (MemoryProfilerStageView)myProfilersView.getStageView(); Executor joiner = MoreExecutors.directExecutor(); myMockLoader.setReturnImmediateFuture(true); 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); myStage.refreshSelectedHeap(); assertThat(stageView.getCaptureInfoMessage().isVisible()).isTrue(); 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(); }