@Test public void test_relative_report_path() throws IOException { SensorContextTester context = getSensorContext("resultset.json", "file1.rb"); new SimpleCovSensor().execute(context); String fileKey = MODULE_KEY + ":file1.rb"; assertThat(context.lineHits(fileKey, 1)).isEqualTo(1); assertThat(context.lineHits(fileKey, 2)).isEqualTo(1); assertThat(context.lineHits(fileKey, 3)).isEqualTo(2); assertThat(context.lineHits(fileKey, 4)).isNull(); assertThat(context.lineHits(fileKey, 5)).isNull(); assertThat(context.lineHits(fileKey, 6)).isEqualTo(1); assertThat(context.lineHits(fileKey, 7)).isEqualTo(0); }
@Override public void execute(SensorContext context) { try { Map<Path, String> reports = getReportFilesAndContents(context); if (reports.isEmpty()) { return; } JSONParser parser = new JSONParser(); Map<String, Map<Integer, Integer>> mergedCoverages = new HashMap<>(); for (Entry<Path, String> report : reports.entrySet()) { try { JSONObject parseResult = (JSONObject) parser.parse(report.getValue()); mergeFileCoverages(mergedCoverages, parseResult.entrySet()); } catch (Exception e) { LOG.error("Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: '{}'", report.getKey(), e); } } saveCoverage(context, mergedCoverages); } catch (IOException e) { LOG.error("Error reading coverage reports", e); } }
SimpleCovSensor implements Sensor { @Override public void execute(SensorContext context) { try { Map<Path, String> reports = getReportFilesAndContents(context); if (reports.isEmpty()) { return; } JSONParser parser = new JSONParser(); Map<String, Map<Integer, Integer>> mergedCoverages = new HashMap<>(); for (Entry<Path, String> report : reports.entrySet()) { try { JSONObject parseResult = (JSONObject) parser.parse(report.getValue()); mergeFileCoverages(mergedCoverages, parseResult.entrySet()); } catch (Exception e) { LOG.error("Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: '{}'", report.getKey(), e); } } saveCoverage(context, mergedCoverages); } catch (IOException e) { LOG.error("Error reading coverage reports", e); } } }
SimpleCovSensor implements Sensor { @Override public void execute(SensorContext context) { try { Map<Path, String> reports = getReportFilesAndContents(context); if (reports.isEmpty()) { return; } JSONParser parser = new JSONParser(); Map<String, Map<Integer, Integer>> mergedCoverages = new HashMap<>(); for (Entry<Path, String> report : reports.entrySet()) { try { JSONObject parseResult = (JSONObject) parser.parse(report.getValue()); mergeFileCoverages(mergedCoverages, parseResult.entrySet()); } catch (Exception e) { LOG.error("Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: '{}'", report.getKey(), e); } } saveCoverage(context, mergedCoverages); } catch (IOException e) { LOG.error("Error reading coverage reports", e); } }  }
SimpleCovSensor implements Sensor { @Override public void execute(SensorContext context) { try { Map<Path, String> reports = getReportFilesAndContents(context); if (reports.isEmpty()) { return; } JSONParser parser = new JSONParser(); Map<String, Map<Integer, Integer>> mergedCoverages = new HashMap<>(); for (Entry<Path, String> report : reports.entrySet()) { try { JSONObject parseResult = (JSONObject) parser.parse(report.getValue()); mergeFileCoverages(mergedCoverages, parseResult.entrySet()); } catch (Exception e) { LOG.error("Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: '{}'", report.getKey(), e); } } saveCoverage(context, mergedCoverages); } catch (IOException e) { LOG.error("Error reading coverage reports", e); } }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); }
SimpleCovSensor implements Sensor { @Override public void execute(SensorContext context) { try { Map<Path, String> reports = getReportFilesAndContents(context); if (reports.isEmpty()) { return; } JSONParser parser = new JSONParser(); Map<String, Map<Integer, Integer>> mergedCoverages = new HashMap<>(); for (Entry<Path, String> report : reports.entrySet()) { try { JSONObject parseResult = (JSONObject) parser.parse(report.getValue()); mergeFileCoverages(mergedCoverages, parseResult.entrySet()); } catch (Exception e) { LOG.error("Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: '{}'", report.getKey(), e); } } saveCoverage(context, mergedCoverages); } catch (IOException e) { LOG.error("Error reading coverage reports", e); } }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context);  }