-
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.
Merge pull request #1361 from hcoles/feature/cross_module
Maven cross module tests
- Loading branch information
Showing
18 changed files
with
450 additions
and
47 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
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
37 changes: 37 additions & 0 deletions
37
pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/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,37 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.example</groupId> | ||
<artifactId>pit-parent-module</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>cross-tests-code</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>cross-tests-code</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
<properties> | ||
<junit.version>4.13.1</junit.version> | ||
</properties> | ||
</project> |
24 changes: 24 additions & 0 deletions
24
...s/pit-cross-module-tests/cross-tests-code/src/main/java/org/example1/SystemUnderTest.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,24 @@ | ||
package org.example1; | ||
|
||
public class SystemUnderTest { | ||
|
||
private int aNumber = 0; | ||
|
||
public SystemUnderTest() { | ||
super(); | ||
|
||
int a = 25; | ||
int b = 10; | ||
if (a < b) { | ||
aNumber = 10; | ||
} else { | ||
aNumber = -25; | ||
} | ||
} | ||
|
||
public String toString() { | ||
return "SystemUnderTest"; | ||
} | ||
|
||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...s/pit-cross-module-tests/cross-tests-code/src/main/java/org/example2/SystemUnderTest.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,30 @@ | ||
package org.example2; | ||
|
||
public class SystemUnderTest { | ||
|
||
private int aNumber = 0; | ||
|
||
public SystemUnderTest() { | ||
super(); | ||
|
||
int a = 25; | ||
int b = 10; | ||
if (a < b) { | ||
aNumber = 10; | ||
} else { | ||
aNumber = -25; | ||
} | ||
} | ||
|
||
public int getNumber() { | ||
return aNumber; | ||
} | ||
|
||
public String toString() { | ||
return "SystemUnderTest"; | ||
} | ||
|
||
public boolean isActive() { | ||
return false; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...st-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/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,42 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.example</groupId> | ||
<artifactId>pit-parent-module</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>cross-tests-tests</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>cross-tests-tests</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.example</groupId> | ||
<artifactId>cross-tests-code</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
<properties> | ||
<junit.version>4.13.1</junit.version> | ||
</properties> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
.../pit-cross-module-tests/cross-tests-tests/src/test/java/org/example1/FileOpeningTest.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,21 @@ | ||
package org.example1; | ||
|
||
import static junit.framework.Assert.assertTrue; | ||
import static junit.framework.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
import org.junit.Test; | ||
|
||
public class FileOpeningTest { | ||
|
||
@Test | ||
public void testOpenFileRelativeToWorkingDirectory() { | ||
SystemUnderTest sut = new SystemUnderTest(); | ||
|
||
File file = new File("src/test/resources/fixture.file"); | ||
assertTrue(file.exists()); | ||
assertNotNull(sut.toString()); | ||
} | ||
|
||
|
||
} |
21 changes: 21 additions & 0 deletions
21
.../pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/FileOpeningTest.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,21 @@ | ||
package org.example2; | ||
|
||
import static junit.framework.Assert.assertTrue; | ||
import static junit.framework.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
import org.junit.Test; | ||
|
||
public class FileOpeningTest { | ||
|
||
@Test | ||
public void testOpenFileRelativeToWorkingDirectory() { | ||
SystemUnderTest sut = new SystemUnderTest(); | ||
|
||
File file = new File("src/test/resources/fixture.file"); | ||
assertTrue(file.exists()); | ||
assertNotNull(sut.toString()); | ||
} | ||
|
||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...-cross-module-tests/cross-tests-tests/src/test/java/org/example2/SystemUnderTestTest.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,19 @@ | ||
package org.example2; | ||
|
||
import static junit.framework.Assert.assertTrue; | ||
import static junit.framework.Assert.assertNotNull; | ||
|
||
import org.junit.Test; | ||
|
||
public class SystemUnderTestTest { | ||
|
||
@Test | ||
public void testGetNumber() { | ||
SystemUnderTest sut = new SystemUnderTest(); | ||
|
||
int result = sut.getNumber(); | ||
assertTrue(result == -25); | ||
} | ||
|
||
|
||
} |
1 change: 1 addition & 0 deletions
1
...c/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/resources/fixture.file
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 @@ | ||
test123 |
87 changes: 87 additions & 0 deletions
87
pitest-maven-verification/src/test/resources/pit-cross-module-tests/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,87 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.example</groupId> | ||
<artifactId>pit-parent-module</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>pit-parent-module</name> | ||
|
||
<properties> | ||
<junit.version>4.13.1</junit.version> | ||
<pit.version>dev-SNAPSHOT</pit.version> | ||
</properties> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-maven</artifactId> | ||
<version>${pit.version}</version> | ||
<configuration> | ||
<crossModule>true</crossModule> | ||
<timestampedReports>false</timestampedReports> | ||
<outputFormats> | ||
<outputFormat>HTML</outputFormat> | ||
<!-- xml is used by the report aggregate --> | ||
<outputFormat>XML</outputFormat> | ||
</outputFormats> | ||
<!-- exportLineCoverage is used by the report aggregate --> | ||
<exportLineCoverage>true</exportLineCoverage> | ||
|
||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
|
||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>pitest</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-maven</artifactId> | ||
<executions> | ||
<execution> | ||
<id>pitest</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>mutationCoverage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<modules> | ||
<module>cross-tests-code</module> | ||
<module>cross-tests-tests</module> | ||
</modules> | ||
</project> |
Oops, something went wrong.