JaCoCoReportReader { public JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore) { if (jacocoExecutionData == null) { return this; } JaCoCoExtensions.logger().info("Analysing {}", jacocoExecutionData); try (InputStream inputStream = new BufferedInputStream(new FileInputStream(jacocoExecutionData))) { if (useCurrentBinaryFormat) { ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } else { org.jacoco.previous.core.data.ExecutionDataReader reader = new org.jacoco.previous.core.data.ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Unable to read %s", jacocoExecutionData.getAbsolutePath()), e); } return this; } JaCoCoReportReader(@Nullable File jacocoExecutionData); JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore); boolean useCurrentBinaryFormat(); CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles);  }
@Test public void reading_file_no_tfound_should_do_nothing() { new JaCoCoReportReader(null).readJacocoReport(mock(IExecutionDataVisitor.class), mock(ISessionInfoVisitor.class)); }
@Test public void analyzing_a_deleted_file_should_fail() throws Exception { File report = testFolder.newFile("jacoco.exec"); FileUtils.copyFile(TestUtils.getResource("/org/sonar/plugins/groovy/jacoco/JaCoCo_incompatible_merge/jacoco-0.7.5.exec"), report); JaCoCoReportReader jacocoReportReader = new JaCoCoReportReader(report); expectedException.expect(IllegalArgumentException.class); if (!report.delete()) { Fail.fail("report was not deleted, unable to complete test."); } ExecutionDataVisitor edv = new ExecutionDataVisitor(); jacocoReportReader.readJacocoReport(edv, edv); }