@Test public void get_report_paths() { SensorContextTester context = SensorContextTester.create(COVERAGE_DIR); context.setSettings(new MapSettings()); Path coverageFile1 = COVERAGE_DIR.resolve("coverage.linux.relative.out").toAbsolutePath(); context.settings().setProperty("sonar.go.coverage.reportPaths", coverageFile1 + ",coverage.linux.absolute.out"); Stream<Path> reportPaths = GoCoverSensor.getReportPaths(context); assertThat(reportPaths).containsExactlyInAnyOrder( coverageFile1, Paths.get("src", "test", "resources", "coverage", "coverage.linux.absolute.out")); }
static Stream<Path> getReportPaths(SensorContext sensorContext) { Configuration config = sensorContext.config(); Path baseDir = sensorContext.fileSystem().baseDir().toPath(); String[] reportPaths = config.getStringArray(REPORT_PATH_KEY); return Arrays.stream(reportPaths).flatMap(reportPath -> isWildcard(reportPath) ? getPatternPaths(baseDir, reportPath) : getRegularPath(baseDir, reportPath)); }
GoCoverSensor implements Sensor { static Stream<Path> getReportPaths(SensorContext sensorContext) { Configuration config = sensorContext.config(); Path baseDir = sensorContext.fileSystem().baseDir().toPath(); String[] reportPaths = config.getStringArray(REPORT_PATH_KEY); return Arrays.stream(reportPaths).flatMap(reportPath -> isWildcard(reportPath) ? getPatternPaths(baseDir, reportPath) : getRegularPath(baseDir, reportPath)); } }
GoCoverSensor implements Sensor { static Stream<Path> getReportPaths(SensorContext sensorContext) { Configuration config = sensorContext.config(); Path baseDir = sensorContext.fileSystem().baseDir().toPath(); String[] reportPaths = config.getStringArray(REPORT_PATH_KEY); return Arrays.stream(reportPaths).flatMap(reportPath -> isWildcard(reportPath) ? getPatternPaths(baseDir, reportPath) : getRegularPath(baseDir, reportPath)); }  }
GoCoverSensor implements Sensor { static Stream<Path> getReportPaths(SensorContext sensorContext) { Configuration config = sensorContext.config(); Path baseDir = sensorContext.fileSystem().baseDir().toPath(); String[] reportPaths = config.getStringArray(REPORT_PATH_KEY); return Arrays.stream(reportPaths).flatMap(reportPath -> isWildcard(reportPath) ? getPatternPaths(baseDir, reportPath) : getRegularPath(baseDir, reportPath)); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); }
GoCoverSensor implements Sensor { static Stream<Path> getReportPaths(SensorContext sensorContext) { Configuration config = sensorContext.config(); Path baseDir = sensorContext.fileSystem().baseDir().toPath(); String[] reportPaths = config.getStringArray(REPORT_PATH_KEY); return Arrays.stream(reportPaths).flatMap(reportPath -> isWildcard(reportPath) ? getPatternPaths(baseDir, reportPath) : getRegularPath(baseDir, reportPath)); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); static final String REPORT_PATH_KEY; }