-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove jacoco agent from classpath if present
fixes #1070
- Loading branch information
Henry Coles
committed
Aug 2, 2022
1 parent
49b5a13
commit 6d86d9a
Showing
8 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
pitest-maven-verification/src/test/resources/pit-jacoco/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>pitest-sample</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<name>pit maven findOccupiedTestPackages coverage</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.0.0-M1</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-maven</artifactId> | ||
<version>${pit.version}</version> | ||
<configuration> | ||
<verbose>true</verbose> | ||
<outputFormats> | ||
<value>XML</value> | ||
</outputFormats> | ||
<timestampedReports>false</timestampedReports> | ||
<exportLineCoverage>true</exportLineCoverage> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.8</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>jacoco-report</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
<!-- Add this checking --> | ||
<execution> | ||
<id>jacoco-check</id> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
<configuration> | ||
<rules> | ||
<rule> | ||
<element>PACKAGE</element> | ||
<limits> | ||
<limit> | ||
<counter>LINE</counter> | ||
<value>COVEREDRATIO</value> | ||
<minimum>0.9</minimum> | ||
</limit> | ||
</limits> | ||
</rule> | ||
</rules> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
...ven-verification/src/test/resources/pit-jacoco/src/main/java/sources/DiscoveredClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package sources; | ||
|
||
public class DiscoveredClass { | ||
|
||
public int add(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...aven-verification/src/test/resources/pit-jacoco/src/main/java/sources/MessageBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package sources; | ||
|
||
public class MessageBuilder { | ||
|
||
public String getMessage(String name) { | ||
|
||
StringBuilder result = new StringBuilder(); | ||
|
||
if (name == null || name.trim().length() == 0) { | ||
result.append("Stuff!"); | ||
} else { | ||
result.append("Hello " + name); | ||
} | ||
return result.toString(); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...-maven-verification/src/test/resources/pit-jacoco/src/test/java/tests/DiscoveredTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package tests; | ||
|
||
import static junit.framework.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
import sources.DiscoveredClass; | ||
|
||
public class DiscoveredTest { | ||
|
||
@Test | ||
public void testAdd() { | ||
assertEquals(2, new DiscoveredClass().add(1, 1)); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...en-verification/src/test/resources/pit-jacoco/src/test/java/tests/TestMessageBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package tests; | ||
|
||
import org.junit.Test; | ||
import sources.MessageBuilder; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class TestMessageBuilder { | ||
|
||
@Test | ||
public void testName() { | ||
MessageBuilder obj = new MessageBuilder(); | ||
assertEquals("Hello there", obj.getMessage("there")); | ||
} | ||
|
||
} |