-
Notifications
You must be signed in to change notification settings - Fork 358
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 #1107 from hcoles/feature/map_of
filter mutations to empty Map.of
- Loading branch information
Showing
8 changed files
with
171 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>pitest-parent</artifactId> | ||
<groupId>org.pitest</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>pitest-modern-verification</artifactId> | ||
<description>Checks pitest against latest support version of java</description> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<release>17</release> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-entry</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-entry</artifactId> | ||
<type>test-jar</type> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest</artifactId> | ||
<type>test-jar</type> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
...t/java/org/pitest/filters/verification/equivalent/EquivalentReturnMutationFilterTest.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,51 @@ | ||
package org.pitest.filters.verification.equivalent; | ||
|
||
import org.junit.Test; | ||
import org.pitest.mutationtest.build.intercept.equivalent.EquivalentReturnMutationFilter; | ||
import org.pitest.verifier.interceptors.InterceptorVerifier; | ||
import org.pitest.verifier.interceptors.VerifierStart; | ||
|
||
import static org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator.EMPTY_RETURNS; | ||
|
||
|
||
public class EquivalentReturnMutationFilterTest { | ||
|
||
InterceptorVerifier v = VerifierStart.forInterceptorFactory(new EquivalentReturnMutationFilter()); | ||
|
||
@Test | ||
public void filtersWhenMapOfHasNoArgs() { | ||
v.usingMutator(EMPTY_RETURNS) | ||
.forClass(HasMapOf.class) | ||
.forAnyCode() | ||
.allMutantsAreFiltered() | ||
.verify(); | ||
} | ||
|
||
@Test | ||
public void filtersWhenSetOfHasNoArgs() { | ||
v.usingMutator(EMPTY_RETURNS) | ||
.forClass(HasSetOf.class) | ||
.forAnyCode() | ||
.allMutantsAreFiltered() | ||
.verify(); | ||
} | ||
|
||
@Test | ||
public void filtersWhenListOfHasNoArgs() { | ||
v.usingMutator(EMPTY_RETURNS) | ||
.forClass(HasListOf.class) | ||
.forAnyCode() | ||
.allMutantsAreFiltered() | ||
.verify(); | ||
} | ||
|
||
@Test | ||
public void doesNotFilterNonEmptyMapOf() { | ||
v.usingMutator(EMPTY_RETURNS) | ||
.forClass(NonEmptyMapOf.class) | ||
.forAnyCode() | ||
.noMutantsAreFiltered() | ||
.verify(); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...dern-verification/src/test/java/org/pitest/filters/verification/equivalent/HasListOf.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 org.pitest.filters.verification.equivalent; | ||
|
||
import java.util.List; | ||
|
||
public class HasListOf { | ||
public List<String> mutateMe() { | ||
return List.of(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...odern-verification/src/test/java/org/pitest/filters/verification/equivalent/HasMapOf.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,10 @@ | ||
package org.pitest.filters.verification.equivalent; | ||
|
||
import java.util.Map; | ||
|
||
public class HasMapOf { | ||
|
||
public Map<String,String> mutateMe() { | ||
return Map.of(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...odern-verification/src/test/java/org/pitest/filters/verification/equivalent/HasSetOf.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 org.pitest.filters.verification.equivalent; | ||
|
||
import java.util.Set; | ||
|
||
public class HasSetOf { | ||
public Set<String> mutateMe() { | ||
return Set.of(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...-verification/src/test/java/org/pitest/filters/verification/equivalent/NonEmptyMapOf.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 org.pitest.filters.verification.equivalent; | ||
|
||
import java.util.Map; | ||
|
||
public class NonEmptyMapOf { | ||
public Map<String,String> mutateMe() { | ||
return Map.of("A", "Z"); | ||
} | ||
} |
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