From be303c6c17c52eba04f100e2c0085aeb8f3c7742 Mon Sep 17 00:00:00 2001 From: Henry Coles Date: Wed, 2 Oct 2024 08:30:01 +0100 Subject: [PATCH] cross module example project --- .../cross-tests-code/pom.xml | 37 +++++++++++ .../java/org/example1/SystemUnderTest.java | 24 ++++++++ .../java/org/example2/SystemUnderTest.java | 30 +++++++++ .../cross-tests-tests/pom.xml | 42 +++++++++++++ .../java/org/example1/FileOpeningTest.java | 21 +++++++ .../java/org/example2/FileOpeningTest.java | 21 +++++++ .../org/example2/SystemUnderTestTest.java | 19 ++++++ .../src/test/resources/fixture.file | 1 + .../resources/pit-cross-module-tests/pom.xml | 61 +++++++++++++++++++ 9 files changed, 256 insertions(+) create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/pom.xml create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example1/SystemUnderTest.java create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example2/SystemUnderTest.java create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/pom.xml create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example1/FileOpeningTest.java create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/FileOpeningTest.java create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/SystemUnderTestTest.java create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/resources/fixture.file create mode 100644 pitest-maven-verification/src/test/resources/pit-cross-module-tests/pom.xml diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/pom.xml b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/pom.xml new file mode 100644 index 000000000..0276c4681 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + + org.example + pit-parent-module + 1.0-SNAPSHOT + + + cross-tests-code + jar + 1.0-SNAPSHOT + cross-tests-code + + + junit + junit + ${junit.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + 4.13.1 + + diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example1/SystemUnderTest.java b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example1/SystemUnderTest.java new file mode 100644 index 000000000..c5fb0fb9e --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example1/SystemUnderTest.java @@ -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"; + } + + +} \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example2/SystemUnderTest.java b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example2/SystemUnderTest.java new file mode 100644 index 000000000..afc937966 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-code/src/main/java/org/example2/SystemUnderTest.java @@ -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; + } +} \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/pom.xml b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/pom.xml new file mode 100644 index 000000000..502bf70cc --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + + org.example + pit-parent-module + 1.0-SNAPSHOT + + + cross-tests-tests + jar + 1.0-SNAPSHOT + cross-tests-tests + + + junit + junit + ${junit.version} + + + org.example + cross-tests-code + ${project.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + 4.13.1 + + diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example1/FileOpeningTest.java b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example1/FileOpeningTest.java new file mode 100644 index 000000000..97796f0ab --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example1/FileOpeningTest.java @@ -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()); + } + + +} \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/FileOpeningTest.java b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/FileOpeningTest.java new file mode 100644 index 000000000..97ade29c8 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/FileOpeningTest.java @@ -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()); + } + + +} \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/SystemUnderTestTest.java b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/SystemUnderTestTest.java new file mode 100644 index 000000000..d3b22fa66 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/java/org/example2/SystemUnderTestTest.java @@ -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); + } + + +} \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/resources/fixture.file b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/resources/fixture.file new file mode 100644 index 000000000..0c759a444 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/cross-tests-tests/src/test/resources/fixture.file @@ -0,0 +1 @@ +test123 \ No newline at end of file diff --git a/pitest-maven-verification/src/test/resources/pit-cross-module-tests/pom.xml b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/pom.xml new file mode 100644 index 000000000..955f71e24 --- /dev/null +++ b/pitest-maven-verification/src/test/resources/pit-cross-module-tests/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + org.example + pit-parent-module + pom + 1.0-SNAPSHOT + pit-parent-module + + + junit + junit + ${junit.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.4 + + 1.8 + 1.8 + + + + + + + + org.pitest + pitest-maven + ${pit.version} + + false + + HTML + + XML + + + true + 26 + 20 + 6 + + + + + + + + + 4.13.1 + + + cross-tests-code + cross-tests-tests + +