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

  CpuCaptureParser.clearPreviouslyLoadedCaptures();
  ProfilingConfiguration config = new ProfilingConfiguration("My Config",
                                                             Cpu.CpuTraceType.ART,
                                                             Cpu.CpuTraceMode.SAMPLED);
  config.setProfilingSamplingIntervalUs(10);
  config.setProfilingBufferSizeInMb(15);
  myStage.getProfilerConfigModel().setProfilingConfiguration(config);
  CpuProfilerTestUtils.captureSuccessfully(myStage, myCpuService, myTransportService, CpuProfilerTestUtils.readValidTrace());
  CpuCaptureMetadata metadata = ((FakeFeatureTracker)myServices.getFeatureTracker()).getLastCpuCaptureMetadata();
  assertThat(metadata.getStatus()).isEqualTo(CpuCaptureMetadata.CaptureStatus.SUCCESS);
  ProfilingConfiguration metadataConfig = metadata.getProfilingConfiguration();
  assertThat(metadataConfig.getProfilingSamplingIntervalUs()).isEqualTo(10);
  assertThat(metadataConfig.getProfilingBufferSizeInMb()).isEqualTo(15);
  assertThat(metadataConfig.getTraceType()).isEqualTo(Cpu.CpuTraceType.ART);
  assertThat(metadataConfig.getMode()).isEqualTo(Cpu.CpuTraceMode.SAMPLED);
  assertThat(metadata.getParsingTimeMs()).isGreaterThan(0L);
  assertThat(metadata.getStoppingTimeMs()).isEqualTo(FakeCpuService.FAKE_STOPPING_TIME_MS);
  assertThat(metadata.getRecordDurationMs()).isGreaterThan(0L);
  assertThat(metadata.getCaptureDurationMs()).isGreaterThan(0L);
  assertThat(metadata.getTraceFileSizeBytes()).isGreaterThan(0);
}