### Question:
CpuProfilerStage extends StreamingStage implements CodeNavigator.Listener { public void setAndSelectCapture(long traceId) { if (getStudioProfilers().getIdeServices().getFeatureConfig().isCpuCaptureStageEnabled()) { goToCaptureStage(traceId); } else { CompletableFuture<CpuCapture> future = getCaptureFuture(traceId); if (future == null) { setCaptureState(myInProgressTraceInfo.equals(Cpu.CpuTraceInfo.getDefaultInstance()) ? CaptureState.IDLE : CaptureState.CAPTURING); } else { future.handleAsync((capture, exception) -> { setCaptureState(myInProgressTraceInfo.equals(Cpu.CpuTraceInfo.getDefaultInstance()) ? CaptureState.IDLE : CaptureState.CAPTURING); if (capture != null) { setAndSelectCapture(capture); setCaptureDetails(DEFAULT_CAPTURE_DETAILS); } return capture; }, getStudioProfilers().getIdeServices().getMainExecutor()); } } } CpuProfilerStage(@NotNull StudioProfilers profilers);  CpuProfilerStage(@NotNull StudioProfilers profilers, @Nullable File importedTrace); @VisibleForTesting  CpuProfilerStage(@NotNull StudioProfilers profilers, @Nullable File importedTrace, @NotNull CpuCaptureParser captureParser); boolean isImportTraceMode(); boolean hasUserUsedCpuCapture(); @NotNull RangeSelectionModel getRangeSelectionModel(); @NotNull EaseOutModel getInstructionsEaseOutModel(); AxisComponentModel getCpuUsageAxis(); AxisComponentModel getThreadCountAxis(); AxisComponentModel getTimeAxisGuide(); DetailedCpuUsage getCpuUsage(); CpuStageLegends getLegends(); DurationDataModel<CpuTraceInfo> getTraceDurations(); String getName(); EventMonitor getEventMonitor(); @NotNull CpuProfilerConfigModel getProfilerConfigModel(); @Override void enter(); @Override void exit(); @NotNull UpdatableManager getUpdatableManager(); AspectModel<CpuProfilerAspect> getAspect(); void toggleCapturing(); void startCapturing(); long getCaptureStartTimeNs(); long getCaptureStopTimeNs(); @NotNull TraceIdsIterator getTraceIdsIterator(); @NotNull CpuCaptureParser getCaptureParser(); long currentTimeNs(); @VisibleForTesting void setCapture(@Nullable CpuCapture capture); void setAndSelectCapture(long traceId); @VisibleForTesting void setAndSelectCapture(@NotNull CpuCapture capture); int getSelectedThread(); void setSelectedThread(int id); @NotNull List<ClockType> getClockTypes(); @NotNull ClockType getClockType(); void setClockType(@NotNull ClockType clockType); @Nullable CpuCapture getCapture(); @NotNull CaptureState getCaptureState(); @NotNull TraceInitiationType getCaptureInitiationType(); void setCaptureState(@NotNull CaptureState captureState); @NotNull FilterResult applyCaptureFilter(@NotNull Filter filter); boolean isApiInitiatedTracingInProgress(); @NotNull CpuTraceDataSeries getCpuTraceDataSeries(); @NotNull CpuThreadsModel getThreadStates(); @NotNull CpuKernelModel getCpuKernelModel(); @NotNull CpuFramesModel getFramesModel(); @NotNull CaptureModel getCaptureModel(); void setCaptureDetails(@Nullable CaptureDetails.Type type); @Nullable CaptureDetails getCaptureDetails(); @Override void onNavigated(@NotNull CodeLocation location); static final int CPU_ART_STOP_TIMEOUT_SEC; }### Answer:
@Test public void setAndSelectCaptureShouldStopStreamingMode() throws IOException, ExecutionException, InterruptedException { CpuCapture capture = CpuProfilerTestUtils.getValidCapture(); myStage.getTimeline().setIsPaused(false); myStage.getTimeline().setStreaming(true); myStage.setAndSelectCapture(capture); assertThat(myStage.getTimeline().isStreaming()).isFalse(); }