Skip to content

Commit

Permalink
Merge pull request #1006 from hcoles/cleanup/further-verifier-migration
Browse files Browse the repository at this point in the history
Remove reliance on xstream for tests
  • Loading branch information
hcoles authored Mar 24, 2022
2 parents 40f2494 + 377dc45 commit 018db30
Show file tree
Hide file tree
Showing 41 changed files with 3,284 additions and 4,523 deletions.

This file was deleted.

7 changes: 0 additions & 7 deletions pitest-entry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@
<artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>
<!-- for the xstream history store. cannot use shaded version -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.pitest.process.ProcessArgs;
import org.pitest.util.ExitCode;
import org.pitest.util.SocketFinder;
import org.pitest.util.Verbosity;
import org.pitest.util.XStreamCloning;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -71,14 +69,6 @@ public void shouldCalculateCoverageForSingleBlockMethods()
assertCoverage(coveredClasses, "test1", 1);
}

// @Test
// public void shouldCalculateCoverageFor2BlockMethods() throws IOException,
// InterruptedException, ExecutionException {
// final List<CoverageResult> coveredClasses =
// runCoverageForTest(TestsForMultiBlockCoverage.class);
// assertCoverage(coveredClasses, "test2", 2);
// }

@Test
public void shouldCalculateCoverageFor3BlockMethods() throws Exception {
final List<CoverageResult> coveredClasses = runCoverageForTest(TestsForMultiBlockCoverage.class);
Expand Down Expand Up @@ -238,26 +228,6 @@ public void shouldCalculateCoverageForLargeMethodThatThrowsException()

}

public static class TestInDifferentClassLoader {
@Test
public void testFoo() {
final ClassLoader cl = new DefaultPITClassloader(new ClassPath(),
XStreamCloning.bootClassLoader());
final Testee testee = new Testee();
final Runnable r = (Runnable) XStreamCloning.cloneForLoader(testee, cl);
r.run();
}

}

@Test
public void shouldCalculateCoverageOfClassesRunInDifferentClassLoader()
throws IOException, InterruptedException {
final List<CoverageResult> coveredClasses = runCoverageForTest(TestInDifferentClassLoader.class);
assertThat(coveredClasses).anyMatch(coverageFor(Testee2.class));
assertThat(coveredClasses).anyMatch(coverageFor(Testee.class));
}

public static class ReliesOnNewLine {
public static String parseNewLines() throws IOException {
final StringWriter sw = new StringWriter();
Expand Down Expand Up @@ -424,7 +394,5 @@ private Predicate<BlockLocation> hasBlock(final int block) {

};
}



}
25 changes: 0 additions & 25 deletions pitest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@
<url>http://pitest.org</url>
<description>Mutation testing system for Java.</description>

<properties>
<surefire.argline/>
</properties>
<profiles>
<profile>
<id>jdk17</id>
<activation>
<jdk>17</jdk>
</activation>
<properties>
<!-- pitest does not use reflection, but some of the tests depend on xstream, which does. Jdk 17 fails with
errors due to the module system. jdk8 does not support the add-opens option, so it must be activated here by jdk-->
<surefire.argline>--illegal-access=permit --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.ref=ALL-UNNAMED</surefire.argline>
</properties>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -59,8 +42,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testNGArtifactName>none:none</testNGArtifactName>
<!-- pitest does not use reflection, but some of the tests depend on xstream, which does -->
<argLine>${surefire.argline}</argLine>

<includes>
<include>org/**/Test*.java</include>
Expand Down Expand Up @@ -241,12 +222,6 @@
<artifactId>equalsverifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.19</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private boolean hasReturnTypeMatchingReceiverType(final String desc,

private void popMethodArgumentsFromStack(String desc) {
final Type[] argumentTypes = Type.getArgumentTypes(desc);
for (final Type argType : argumentTypes) {
popArgument(argType);
for (int i = argumentTypes.length; i != 0; i--) {
popArgument(argumentTypes[i - 1]);
}
}

Expand Down
18 changes: 5 additions & 13 deletions pitest/src/test/java/org/pitest/TestResultTest.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
package org.pitest;

import static org.junit.Assert.fail;

import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.Test;
import org.pitest.testapi.Description;
import org.pitest.testapi.TestResult;
import org.pitest.testapi.TestUnitState;
import org.pitest.util.XStreamCloning;


public class TestResultTest {

@Test
public void shouldCloneViaXStreamWithoutError() throws Exception {
try {
final TestResult testee = new TestResult((Description) null, null,
TestUnitState.FINISHED);
XStreamCloning.clone(testee);
} catch (final Throwable t) {
fail();
}
public void shouldObeyHashcodeEqualsContract() {
EqualsVerifier.forClass(TestResult.class)
.verify();
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.pitest.classinfo;

import org.pitest.quickbuilder.Builder;

public class ClassInfoMother {

interface ClassInfoBuilderf extends Builder<ClassInfo> {
ClassInfoBuilder withId(Builder<ClassIdentifier> id);
}

public static ClassInfo make(final ClassIdentifier id) {
return make(id, new DefaultClassPointer(null));
}
Expand Down
Loading

0 comments on commit 018db30

Please sign in to comment.