@Test
public void selectARangeWithNoCapturesShouldKeepCurrentCaptureSelected() throws InterruptedException, IOException {

  assertThat(myStage.getCapture()).isNull();
  CpuProfilerTestUtils.captureSuccessfully(myStage, myCpuService, myTransportService, CpuProfilerTestUtils.readValidTrace());
  assertThat(myStage.getCapture()).isNotNull();
  CpuCapture capture = myStage.getCapture();
  Range selectionRange = myStage.getTimeline().getSelectionRange();
  // Select an area before the capture.
  selectionRange.set(capture.getRange().getMin() - 20, capture.getRange().getMin() - 10);
  // Last selected capture should remain selected.
  assertThat(myStage.getCapture()).isEqualTo(capture);
}