JaCoCoItSensor implements Sensor { @Override public void execute(SensorContext context) { if (shouldExecuteOnProject()) { new ITAnalyzer().analyse(context); } } JaCoCoItSensor(JaCoCoConfiguration configuration, GroovyFileSystem fileSystem, PathResolver pathResolver, Settings settings); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context);  }
@Test public void test_read_execution_data() { when(pathResolver.relativeFile(any(File.class), ArgumentMatchers.endsWith(".exec"))).thenReturn(jacocoExecutionData); SensorContextTester context = SensorContextTester.create(new File("")); sensor.execute(context); int[] oneHitlines = {9, 10, 25}; int[] zeroHitlines = {14, 15, 17, 21, 29, 30, 32, 33, 38, 42, 47}; int[] conditionLines = {14, 29, 30}; for (int zeroHitline : zeroHitlines) { assertThat(context.lineHits(":example/Hello.groovy", CoverageType.IT, zeroHitline)).isEqualTo(0); } for (int oneHitline : oneHitlines) { assertThat(context.lineHits(":example/Hello.groovy", CoverageType.IT, oneHitline)).isEqualTo(1); } for (int conditionLine : conditionLines) { assertThat(context.conditions(":example/Hello.groovy", CoverageType.IT, conditionLine)).isEqualTo(2); assertThat(context.coveredConditions(":example/Hello.groovy", CoverageType.IT, conditionLine)).isEqualTo(0); } }