### Question:
GoCoverageReport { 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)); } private  GoCoverageReport(); static void saveCoverageReports(SensorContext sensorContext, GoPathContext goContext); static final String REPORT_PATH_KEY; }### Answer:
@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 = GoCoverageReport.getReportPaths(context); assertThat(reportPaths).containsExactlyInAnyOrder( coverageFile1, Paths.get("src", "test", "resources", "coverage", "coverage.linux.absolute.out")); }
@Test public void get_report_paths_with_wildcards() { SensorContextTester context = SensorContextTester.create(COVERAGE_DIR); context.setSettings(new MapSettings()); context.settings().setProperty("sonar.go.coverage.reportPaths", "*.absolute.out,glob" + File.separator +"*.out, test*" + File.separator +"*.out, coverage?.out"); Stream<Path> reportPaths = GoCoverageReport.getReportPaths(context); assertThat(reportPaths).containsExactlyInAnyOrder( Paths.get("src", "test", "resources", "coverage", "coverage.linux.absolute.out"), Paths.get("src", "test", "resources", "coverage", "coverage.win.absolute.out"), Paths.get("src", "test", "resources", "coverage", "glob", "coverage.glob.out"), Paths.get("src", "test", "resources", "coverage", "test1", "coverage.out"), Paths.get("src", "test", "resources", "coverage", "coverage1.out")); context.settings().setProperty("sonar.go.coverage.reportPaths", "**" + File.separator +"coverage.glob.out"); Stream<Path> reportPaths2 = GoCoverageReport.getReportPaths(context); assertThat(reportPaths2).containsExactlyInAnyOrder( Paths.get("src", "test", "resources", "coverage", "glob", "coverage.glob.out")); }