@Test public void shouldParseReport() throws Exception { DefaultInputFile inputFile = new DefaultInputFile("key", "src/example/file.lua") .setLanguage(Lua.KEY) .setType(InputFile.Type.MAIN) .initMetadata(new FileMetadata().readMetadata(new FileReader(TEST_DIR + "src/example/file.lua"))); tester.fileSystem().add(inputFile); tester.settings().setProperty(LuaPlugin.COBERTURA_REPORT_PATH, "coverage.xml"); sensor.execute(tester); String componentKey = "key:src/example/file.lua"; Integer[] expectedConditions = {2, null, null, null, null, null, null, null, null, null}; Integer[] expectedCoveredConditions = {1, null, null, null, null, null, null, null, null, null}; Integer[] expectedHits = {0, null, null, null, null, null, 0, null, null, null}; for (int line = 1; line <= expectedConditions.length; line++) { assertThat(tester.coveredConditions(componentKey, CoverageType.UNIT, line)).as("line " + line).isEqualTo(expectedCoveredConditions[line - 1]); assertThat(tester.conditions(componentKey, CoverageType.UNIT, line)).as("line " + line).isEqualTo(expectedConditions[line - 1]); assertThat(tester.lineHits(componentKey, CoverageType.UNIT, line)).as("line " + line).isEqualTo(expectedHits[line - 1]); assertThat(tester.coveredConditions(componentKey, CoverageType.IT, line)).isNull(); assertThat(tester.lineHits(componentKey, CoverageType.IT, line)).isNull(); assertThat(tester.coveredConditions(componentKey, CoverageType.OVERALL, line)).isNull(); assertThat(tester.lineHits(componentKey, CoverageType.OVERALL, line)).isNull(); } }
@Override public void execute(SensorContext context) { String reportPath = context.settings().getString(LuaPlugin.COBERTURA_REPORT_PATH); if (reportPath != null) { File xmlFile = getIOFile(context.fileSystem(), reportPath); if (xmlFile.exists()) { LOGGER.info("Analyzing Cobertura report: " + reportPath); CoberturaReportParser.parseReport(xmlFile, context); } else { LOGGER.info("Cobertura xml report not found: " + reportPath); } } else { LOGGER.info("No Cobertura report provided (see '" + LuaPlugin.COBERTURA_REPORT_PATH + "' property)"); } }
CoberturaSensor implements Sensor { @Override public void execute(SensorContext context) { String reportPath = context.settings().getString(LuaPlugin.COBERTURA_REPORT_PATH); if (reportPath != null) { File xmlFile = getIOFile(context.fileSystem(), reportPath); if (xmlFile.exists()) { LOGGER.info("Analyzing Cobertura report: " + reportPath); CoberturaReportParser.parseReport(xmlFile, context); } else { LOGGER.info("Cobertura xml report not found: " + reportPath); } } else { LOGGER.info("No Cobertura report provided (see '" + LuaPlugin.COBERTURA_REPORT_PATH + "' property)"); } } }
CoberturaSensor implements Sensor { @Override public void execute(SensorContext context) { String reportPath = context.settings().getString(LuaPlugin.COBERTURA_REPORT_PATH); if (reportPath != null) { File xmlFile = getIOFile(context.fileSystem(), reportPath); if (xmlFile.exists()) { LOGGER.info("Analyzing Cobertura report: " + reportPath); CoberturaReportParser.parseReport(xmlFile, context); } else { LOGGER.info("Cobertura xml report not found: " + reportPath); } } else { LOGGER.info("No Cobertura report provided (see '" + LuaPlugin.COBERTURA_REPORT_PATH + "' property)"); } }  }
CoberturaSensor implements Sensor { @Override public void execute(SensorContext context) { String reportPath = context.settings().getString(LuaPlugin.COBERTURA_REPORT_PATH); if (reportPath != null) { File xmlFile = getIOFile(context.fileSystem(), reportPath); if (xmlFile.exists()) { LOGGER.info("Analyzing Cobertura report: " + reportPath); CoberturaReportParser.parseReport(xmlFile, context); } else { LOGGER.info("Cobertura xml report not found: " + reportPath); } } else { LOGGER.info("No Cobertura report provided (see '" + LuaPlugin.COBERTURA_REPORT_PATH + "' property)"); } }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); }
CoberturaSensor implements Sensor { @Override public void execute(SensorContext context) { String reportPath = context.settings().getString(LuaPlugin.COBERTURA_REPORT_PATH); if (reportPath != null) { File xmlFile = getIOFile(context.fileSystem(), reportPath); if (xmlFile.exists()) { LOGGER.info("Analyzing Cobertura report: " + reportPath); CoberturaReportParser.parseReport(xmlFile, context); } else { LOGGER.info("Cobertura xml report not found: " + reportPath); } } else { LOGGER.info("No Cobertura report provided (see '" + LuaPlugin.COBERTURA_REPORT_PATH + "' property)"); } }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context);  }