@Test public void testLogWhenUnresolvedInputFiles() throws IOException { Path baseDir = COVERAGE_DIR.toAbsolutePath(); Path reportPath = baseDir.resolve("scoverage.xml"); SensorContextTester context = getSensorContext(reportPath.toString()); new ScoverageSensor().execute(context); String expectedMessage = "Fail to resolve 2 file(s). No coverage data will be imported on the following file(s): /Absolute/Path/To/file1.scala;/Absolute/Path/To/file2.scala"; assertThat(logTester.logs().contains(expectedMessage)).isTrue(); }
@Override public void execute(SensorContext context) { List<File> reportFiles = getReportFiles(context); if (reportFiles.isEmpty()) { return; } Set<String> unresolvedInputFile = new HashSet<>(); for (File f : reportFiles) { LOG.info("Importing coverage from {}", f.getPath()); try(InputStream in = new FileInputStream(f)){ readReportFile(in, context, unresolvedInputFile); } catch (IOException | XMLStreamException | NumberFormatException e) { LOG.error("File '{}' can't be read. " + e.toString(), f, e); } } logUnresolvedInputFiles(unresolvedInputFile); }
ScoverageSensor implements Sensor { @Override public void execute(SensorContext context) { List<File> reportFiles = getReportFiles(context); if (reportFiles.isEmpty()) { return; } Set<String> unresolvedInputFile = new HashSet<>(); for (File f : reportFiles) { LOG.info("Importing coverage from {}", f.getPath()); try(InputStream in = new FileInputStream(f)){ readReportFile(in, context, unresolvedInputFile); } catch (IOException | XMLStreamException | NumberFormatException e) { LOG.error("File '{}' can't be read. " + e.toString(), f, e); } } logUnresolvedInputFiles(unresolvedInputFile); } }
ScoverageSensor implements Sensor { @Override public void execute(SensorContext context) { List<File> reportFiles = getReportFiles(context); if (reportFiles.isEmpty()) { return; } Set<String> unresolvedInputFile = new HashSet<>(); for (File f : reportFiles) { LOG.info("Importing coverage from {}", f.getPath()); try(InputStream in = new FileInputStream(f)){ readReportFile(in, context, unresolvedInputFile); } catch (IOException | XMLStreamException | NumberFormatException e) { LOG.error("File '{}' can't be read. " + e.toString(), f, e); } } logUnresolvedInputFiles(unresolvedInputFile); }  }
ScoverageSensor implements Sensor { @Override public void execute(SensorContext context) { List<File> reportFiles = getReportFiles(context); if (reportFiles.isEmpty()) { return; } Set<String> unresolvedInputFile = new HashSet<>(); for (File f : reportFiles) { LOG.info("Importing coverage from {}", f.getPath()); try(InputStream in = new FileInputStream(f)){ readReportFile(in, context, unresolvedInputFile); } catch (IOException | XMLStreamException | NumberFormatException e) { LOG.error("File '{}' can't be read. " + e.toString(), f, e); } } logUnresolvedInputFiles(unresolvedInputFile); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); }
ScoverageSensor implements Sensor { @Override public void execute(SensorContext context) { List<File> reportFiles = getReportFiles(context); if (reportFiles.isEmpty()) { return; } Set<String> unresolvedInputFile = new HashSet<>(); for (File f : reportFiles) { LOG.info("Importing coverage from {}", f.getPath()); try(InputStream in = new FileInputStream(f)){ readReportFile(in, context, unresolvedInputFile); } catch (IOException | XMLStreamException | NumberFormatException e) { LOG.error("File '{}' can't be read. " + e.toString(), f, e); } } logUnresolvedInputFiles(unresolvedInputFile); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context);  }