From 15ceef5a7bcbd0c8fe1fbe54854d78735eace2e4 Mon Sep 17 00:00:00 2001 From: Henry Coles Date: Tue, 31 Aug 2021 10:47:18 +0100 Subject: [PATCH] pluggable mutators Mutators are now pluggable via an expanded version of the service discovery system. Mutator names must now match the string used to specify them on the commandline (which is less confusing). A new interface MutatorGroup allows mutators to be grouped together under a name, as was previously achieved via the static calls in Mutator. The service loader now accepts the following types of classes * Classes with a no arg constructor * Enums with a single instance * Classes with a static method named 'factory' returning a list of the interface This allow most of the existing mutators to be discovered with little modification. Mutators can now be added by creating a plugin with an entry in a org.pitest.mutationtest.engine.gregor.MethodMutatorFactory file. --- README.md | 19 +- .../commandline/OptionsParserTest.java | 8 +- .../EquivalentReturnMutationFilter.java | 22 +- .../equivalent/NullFlatMapFilter.java | 4 +- .../ExcludedAnnotationInterceptorTest.java | 2 +- .../EqualsPerformanceShortcutFilterTest.java | 2 +- .../EquivalentReturnMutationFilterTest.java | 28 +- .../intercept/equivalent/NullFlatmapTest.java | 4 +- .../javafeatures/EnumConstructorTest.java | 4 +- .../javafeatures/ForEachFilterTest.java | 12 +- .../InlinedFinallyBlockFilterTest.java | 12 +- .../timeout/AvoidForLoopCounterTest.java | 2 +- .../InfiniteForLoopFilterFactoryTest.java | 4 +- .../InfiniteIteratorLoopFilterTest.java | 4 +- .../coverage/execute/CoverageMinion.java | 3 +- .../config/ClientPluginServices.java | 1 - .../engine/gregor/MethodMutationContext.java | 1 - .../engine/gregor/MethodMutatorFactory.java | 3 + .../engine/gregor/config/Mutator.java | 381 +++--------------- .../engine/gregor/config/MutatorGroup.java | 18 + .../gregor/config/StandardMutatorGroups.java | 33 ++ .../mutators/ConditionalsBoundaryMutator.java | 2 +- .../mutators/ConstructorCallMutator.java | 2 +- .../gregor/mutators/IncrementsMutator.java | 2 +- .../mutators/InlineConstantMutator.java | 2 +- .../gregor/mutators/InvertNegsMutator.java | 2 +- .../engine/gregor/mutators/MathMutator.java | 2 +- .../mutators/NegateConditionalsMutator.java | 2 +- .../mutators/NonVoidMethodCallMutator.java | 2 +- .../mutators/RemoveConditionalMutator.java | 8 +- .../RemoveConditionalMutatorGroup.java | 22 + .../gregor/mutators/ReturnValsMutator.java | 3 +- .../mutators/VoidMethodCallMutator.java | 2 +- .../ArgumentPropagationMutator.java | 4 +- .../ArgumentPropagationVisitor.java | 2 +- .../experimental/BigIntegerMutator.java | 4 +- .../experimental/MemberVariableMutator.java | 2 +- .../experimental/NakedReceiverMutator.java | 2 +- .../experimental/RemoveIncrementsMutator.java | 2 +- .../experimental/RemoveSwitchMutator.java | 8 +- .../RemoveSwitchMutatorGroup.java | 14 + .../mutators/experimental/SwitchMutator.java | 2 +- .../BooleanFalseReturnValsMutator.java | 4 +- .../BooleanTrueReturnValsMutator.java | 4 +- .../EmptyObjectReturnValsMutator.java | 4 +- .../{ => returns}/NullReturnValsMutator.java | 4 +- .../PrimitiveReturnsMutator.java | 4 +- .../mutators/returns/ReturnsMutatorGroup.java | 20 + .../engine/gregor/mutators/rv/ABSMutator.java | 2 +- .../gregor/mutators/rv/AOD1Mutator.java | 2 +- .../gregor/mutators/rv/AOD2Mutator.java | 2 +- .../gregor/mutators/rv/AOR1Mutator.java | 2 +- .../gregor/mutators/rv/AOR2Mutator.java | 2 +- .../gregor/mutators/rv/AOR3Mutator.java | 2 +- .../gregor/mutators/rv/AOR4Mutator.java | 2 +- .../gregor/mutators/rv/CRCR1Mutator.java | 2 +- .../gregor/mutators/rv/CRCR2Mutator.java | 2 +- .../gregor/mutators/rv/CRCR3Mutator.java | 2 +- .../gregor/mutators/rv/CRCR4Mutator.java | 2 +- .../gregor/mutators/rv/CRCR5Mutator.java | 2 +- .../gregor/mutators/rv/CRCR6Mutator.java | 2 +- .../gregor/mutators/rv/OBBN1Mutator.java | 2 +- .../gregor/mutators/rv/OBBN2Mutator.java | 2 +- .../gregor/mutators/rv/OBBN3Mutator.java | 2 +- .../gregor/mutators/rv/ROR1Mutator.java | 2 +- .../gregor/mutators/rv/ROR2Mutator.java | 2 +- .../gregor/mutators/rv/ROR3Mutator.java | 2 +- .../gregor/mutators/rv/ROR4Mutator.java | 2 +- .../gregor/mutators/rv/ROR5Mutator.java | 2 +- .../gregor/mutators/rv/RVMutatorGroups.java | 42 ++ .../gregor/mutators/rv/UOI1Mutator.java | 2 +- .../gregor/mutators/rv/UOI2Mutator.java | 2 +- .../gregor/mutators/rv/UOI3Mutator.java | 2 +- .../gregor/mutators/rv/UOI4Mutator.java | 2 +- .../execute/MutationTestMinion.java | 2 +- .../java/org/pitest/util/ServiceLoader.java | 41 +- ...iontest.engine.gregor.MethodMutatorFactory | 51 +++ ...tiontest.engine.gregor.config.MutatorGroup | 6 + .../gregor/GregorMutationEngineTest.java | 4 +- .../engine/gregor/TestGregorMutater.java | 10 +- .../engine/gregor/config/MutatorTest.java | 260 +++++++++++- .../ArgumentPropagationMutatorTest.java | 4 +- .../mutators/BigIntegerMutatorTest.java | 2 +- .../BooleanFalseReturnValsMutatorTest.java | 3 +- .../BooleanTrueReturnValsMutatorTest.java | 3 +- .../ConditionalsBoundaryMutatorTest.java | 6 +- .../mutators/ConstructorCallMutatorTest.java | 6 +- .../mutators/EmptyObjectReturnValsTest.java | 3 +- .../mutators/IncrementsMutatorTest.java | 2 +- .../mutators/InlineConstantMutatorTest.java | 2 +- .../mutators/InvertNegsMutatorTest.java | 2 +- .../gregor/mutators/MathMutatorTest.java | 2 +- .../NegateConditionalsMutatorTest.java | 2 +- .../NonVoidMethodCallMutatorTest.java | 4 +- .../mutators/NullReturnValsMutatorTest.java | 3 +- .../mutators/PrimitiveReturnMutatorTest.java | 3 +- .../RemoveConditionalMutatorTest.java | 8 +- .../mutators/ReturnValsMutatorTest.java | 2 +- .../mutators/VoidMethodCallMutatorTest.java | 2 +- .../MemberVariableMutatorTest.java | 2 +- .../NakedReceiverMutatorTest.java | 4 +- .../RemoveIncrementsMutatorTest.java | 6 +- .../experimental/SwitchMutatorTest.java | 2 +- .../gregor/mutators/rv/ABSMutatorTest.java | 3 +- .../gregor/mutators/rv/AOD1MutatorTest.java | 3 +- .../gregor/mutators/rv/AOD2MutatorTest.java | 3 +- .../gregor/mutators/rv/AOR1MutatorTest.java | 3 +- .../gregor/mutators/rv/AOR2MutatorTest.java | 3 +- .../gregor/mutators/rv/AOR3MutatorTest.java | 3 +- .../gregor/mutators/rv/AOR4MutatorTest.java | 3 +- .../engine/gregor/mutators/rv/CRCR1Test.java | 3 +- .../engine/gregor/mutators/rv/CRCR2Test.java | 3 +- .../engine/gregor/mutators/rv/CRCR3Test.java | 3 +- .../engine/gregor/mutators/rv/CRCR4Test.java | 3 +- .../engine/gregor/mutators/rv/CRCR5Test.java | 3 +- .../engine/gregor/mutators/rv/CRCR6Test.java | 3 +- .../gregor/mutators/rv/OBBN1MutatorTest.java | 3 +- .../gregor/mutators/rv/OBBN2MutatorTest.java | 3 +- .../gregor/mutators/rv/OBBN3MutatorTest.java | 3 +- .../gregor/mutators/rv/ROR1MutatorTest.java | 3 +- .../gregor/mutators/rv/ROR2MutatorTest.java | 3 +- .../gregor/mutators/rv/ROR3MutatorTest.java | 3 +- .../gregor/mutators/rv/ROR4MutatorTest.java | 3 +- .../gregor/mutators/rv/ROR5MutatorTest.java | 3 +- .../gregor/mutators/rv/UOI1MutatorTest.java | 3 +- .../gregor/mutators/rv/UOI2MutatorTest.java | 3 +- .../gregor/mutators/rv/UOI3MutatorTest.java | 3 +- .../gregor/mutators/rv/UOI4MutatorTest.java | 3 +- 128 files changed, 755 insertions(+), 557 deletions(-) create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/MutatorGroup.java create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/StandardMutatorGroups.java create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorGroup.java rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => experimental}/ArgumentPropagationMutator.java (94%) rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => experimental}/ArgumentPropagationVisitor.java (98%) create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutatorGroup.java rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => returns}/BooleanFalseReturnValsMutator.java (97%) rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => returns}/BooleanTrueReturnValsMutator.java (97%) rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => returns}/EmptyObjectReturnValsMutator.java (99%) rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => returns}/NullReturnValsMutator.java (97%) rename pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/{ => returns}/PrimitiveReturnsMutator.java (98%) create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/ReturnsMutatorGroup.java create mode 100644 pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/RVMutatorGroups.java create mode 100644 pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.MethodMutatorFactory create mode 100644 pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.config.MutatorGroup diff --git a/README.md b/README.md index 3a64319ca..c55048eb4 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,23 @@ Read all about it at http://pitest.org ## Releases -### current snapshot +### current snapshot (1.7.0) -TBC - release version will be 1.7.0 due to internal changes that may -break some 3rd party plugins. +* #923 Internal interface changes +* #930 Pluggable mutators + +Due to internal changes some third party plugins maybe incompatible with this release. + +All history files should be deleted before upgrading. + +The names of the remove conditionals mutators have changed slightly as a result of #930 and +may need to be updated in build scripts if explicitly activated. ### 1.6.9 -* #922 Filter equivalent stream.empty mutants in flatMap calls -* #921 Guarantee order of mutation operators -* #919 Filter junk mutations in java records +* #922 Filter equivalent stream.empty mutants in flatMap calls +* #921 Guarantee order of mutation operators +* #919 Filter junk mutations in java records ### 1.6.8 diff --git a/pitest-command-line/src/test/java/org/pitest/mutationtest/commandline/OptionsParserTest.java b/pitest-command-line/src/test/java/org/pitest/mutationtest/commandline/OptionsParserTest.java index bef0cb635..cf8093d44 100644 --- a/pitest-command-line/src/test/java/org/pitest/mutationtest/commandline/OptionsParserTest.java +++ b/pitest-command-line/src/test/java/org/pitest/mutationtest/commandline/OptionsParserTest.java @@ -113,11 +113,11 @@ public void shouldParseCommaSeparatedListOfJVMArgs() { @Test public void shouldParseCommaSeparatedListOfMutationOperators() { final ReportOptions actual = parseAddingRequiredArgs("--mutators", - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.name() + "," - + MathMutator.MATH_MUTATOR.name()); + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY.name() + "," + + MathMutator.MATH.name()); assertEquals(Arrays.asList( - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.name(), - MathMutator.MATH_MUTATOR.name()), actual.getMutators()); + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY.name(), + MathMutator.MATH.name()), actual.getMutators()); } @Test diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilter.java b/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilter.java index cb9977baa..b4eecedd2 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilter.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilter.java @@ -29,11 +29,11 @@ import org.pitest.mutationtest.build.MutationInterceptorFactory; import org.pitest.mutationtest.engine.Mutater; import org.pitest.mutationtest.engine.MutationDetails; -import org.pitest.mutationtest.engine.gregor.mutators.BooleanFalseReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.BooleanTrueReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.PrimitiveReturnsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator; import org.pitest.plugin.Feature; import org.pitest.sequence.Context; import org.pitest.sequence.Match; @@ -95,7 +95,7 @@ class HardCodedTrueEquivalentFilter implements MutationInterceptor { private static final Set MUTATOR_IDS = new HashSet<>(); static { - MUTATOR_IDS.add(BooleanTrueReturnValsMutator.BOOLEAN_TRUE_RETURN.getGloballyUniqueId()); + MUTATOR_IDS.add(BooleanTrueReturnValsMutator.TRUE_RETURNS.getGloballyUniqueId()); } private ClassTree currentClass; @@ -159,8 +159,8 @@ class PrimitiveEquivalentFilter implements MutationInterceptor { ZERO_CONSTANTS.add(Opcodes.FCONST_0); ZERO_CONSTANTS.add(Opcodes.DCONST_0); - MUTATOR_IDS.add(PrimitiveReturnsMutator.PRIMITIVE_RETURN_VALS_MUTATOR.getGloballyUniqueId()); - MUTATOR_IDS.add(BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN.getGloballyUniqueId()); + MUTATOR_IDS.add(PrimitiveReturnsMutator.PRIMITIVE_RETURNS.getGloballyUniqueId()); + MUTATOR_IDS.add(BooleanFalseReturnValsMutator.FALSE_RETURNS.getGloballyUniqueId()); } private ClassTree currentClass; @@ -224,8 +224,8 @@ class EmptyReturnsFilter implements MutationInterceptor { ZERO_CONSTANTS.add(Opcodes.FCONST_0); ZERO_CONSTANTS.add(Opcodes.DCONST_0); - MUTATOR_IDS.add(EmptyObjectReturnValsMutator.EMPTY_RETURN_VALUES.getGloballyUniqueId()); - MUTATOR_IDS.add(BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN.getGloballyUniqueId()); + MUTATOR_IDS.add(EmptyObjectReturnValsMutator.EMPTY_RETURNS.getGloballyUniqueId()); + MUTATOR_IDS.add(BooleanFalseReturnValsMutator.FALSE_RETURNS.getGloballyUniqueId()); } private ClassTree currentClass; @@ -314,7 +314,7 @@ public void end() { class NullReturnsFilter implements MutationInterceptor { - private static final String MUTATOR_ID = NullReturnValsMutator.NULL_RETURN_VALUES.getGloballyUniqueId(); + private static final String MUTATOR_ID = NullReturnValsMutator.NULL_RETURNS.getGloballyUniqueId(); private ClassTree currentClass; diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatMapFilter.java b/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatMapFilter.java index 9595e7007..70f93694a 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatMapFilter.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatMapFilter.java @@ -14,7 +14,7 @@ import org.pitest.mutationtest.engine.Location; import org.pitest.mutationtest.engine.Mutater; import org.pitest.mutationtest.engine.MutationDetails; -import org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; import org.pitest.sequence.Context; import org.pitest.sequence.Match; import org.pitest.sequence.QueryParams; @@ -97,7 +97,7 @@ public Collection intercept(Collection mutatio } private boolean isStreamEmptyMutantWithOnlyFlatMapCalls(MutationDetails mutationDetails) { - if (!mutationDetails.getMutator().equals(NullReturnValsMutator.NULL_RETURN_VALUES.getGloballyUniqueId())) { + if (!mutationDetails.getMutator().equals(NullReturnValsMutator.NULL_RETURNS.getGloballyUniqueId())) { return false; } diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/annotations/ExcludedAnnotationInterceptorTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/annotations/ExcludedAnnotationInterceptorTest.java index 3b23ec926..8faa0ebc9 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/annotations/ExcludedAnnotationInterceptorTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/annotations/ExcludedAnnotationInterceptorTest.java @@ -30,7 +30,7 @@ public class ExcludedAnnotationInterceptorTest { @Before public void setUp() { final ClassloaderByteArraySource source = ClassloaderByteArraySource.fromContext(); - final Collection mutators = Collections.singleton((MethodMutatorFactory)VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR); + final Collection mutators = Collections.singleton((MethodMutatorFactory)VoidMethodCallMutator.VOID_METHOD_CALLS); this.mutator = new GregorMutater(source, m -> true, mutators); } diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EqualsPerformanceShortcutFilterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EqualsPerformanceShortcutFilterTest.java index 9c69413bf..1539affd9 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EqualsPerformanceShortcutFilterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EqualsPerformanceShortcutFilterTest.java @@ -40,7 +40,7 @@ public void shouldNotFilterShortCutMutantsNotInEqualsMethods() { @Test public void shouldNotFilterGeneralMutantsInEqualMethods() { final GregorMutater mutator = createMutator( - ReturnValsMutator.RETURN_VALS_MUTATOR); + ReturnValsMutator.RETURN_VALS); final List mutations = mutator .findMutations(ClassName.fromClass(HasNonShortCutEquals.class)); assertThat(mutations).hasSize(1); diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilterTest.java index 40eeaea62..54ee93d37 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/EquivalentReturnMutationFilterTest.java @@ -4,9 +4,9 @@ import org.pitest.mutationtest.build.InterceptorType; import org.pitest.mutationtest.build.MutationInterceptor; import org.pitest.mutationtest.build.intercept.javafeatures.FilterTester; -import org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.PrimitiveReturnsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator; import java.util.ArrayList; import java.util.Collections; @@ -15,18 +15,18 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; -import static org.pitest.mutationtest.engine.gregor.mutators.BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN; -import static org.pitest.mutationtest.engine.gregor.mutators.BooleanTrueReturnValsMutator.BOOLEAN_TRUE_RETURN; +import static org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator.FALSE_RETURNS; +import static org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator.TRUE_RETURNS; public class EquivalentReturnMutationFilterTest { MutationInterceptor testee = new EquivalentReturnMutationFilter().createInterceptor(null); - FilterTester verifier = new FilterTester("", this.testee, PrimitiveReturnsMutator.PRIMITIVE_RETURN_VALS_MUTATOR - , EmptyObjectReturnValsMutator.EMPTY_RETURN_VALUES - , NullReturnValsMutator.NULL_RETURN_VALUES - , BOOLEAN_FALSE_RETURN - , BOOLEAN_TRUE_RETURN); + FilterTester verifier = new FilterTester("", this.testee, PrimitiveReturnsMutator.PRIMITIVE_RETURNS + , EmptyObjectReturnValsMutator.EMPTY_RETURNS + , NullReturnValsMutator.NULL_RETURNS + , FALSE_RETURNS + , TRUE_RETURNS); @Test public void shouldDeclareTypeAsFilter() { @@ -55,19 +55,19 @@ public void filtersEquivalentPrimitiveIntMutantsInTryCatch() { @Test public void filtersEquivalentPrimitiveBooleanMutants() { - this.verifier.assertFiltersMutationsFromMutator(BOOLEAN_FALSE_RETURN.getGloballyUniqueId() + this.verifier.assertFiltersMutationsFromMutator(FALSE_RETURNS.getGloballyUniqueId() , AlreadyReturnsFalse.class); } @Test public void filtersEquivalentPrimitiveBooleanTrueMutants() { - this.verifier.assertFiltersMutationsFromMutator(BOOLEAN_TRUE_RETURN.getGloballyUniqueId() + this.verifier.assertFiltersMutationsFromMutator(TRUE_RETURNS.getGloballyUniqueId() , ReturnsTrue.class); } @Test public void filtersEquivalentPrimitiveBooleanTrueMutantsInTryCatch() { - this.verifier.assertFiltersMutationsFromMutator(BOOLEAN_TRUE_RETURN.getGloballyUniqueId() + this.verifier.assertFiltersMutationsFromMutator(TRUE_RETURNS.getGloballyUniqueId() , ReturnsTrueInTryCatch.class); } @@ -93,7 +93,7 @@ public void filtersEquivalentBoxedBooleanMutants() { @Test public void filtersEquivalentBoxedBooleanTrueMutants() { - this.verifier.assertFiltersMutationsFromMutator(BOOLEAN_TRUE_RETURN.getGloballyUniqueId() + this.verifier.assertFiltersMutationsFromMutator(TRUE_RETURNS.getGloballyUniqueId() , AlreadyReturnsBoxedTrue.class); } diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatmapTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatmapTest.java index 16ff962da..9859ee833 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatmapTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/equivalent/NullFlatmapTest.java @@ -5,7 +5,7 @@ import org.pitest.mutationtest.build.MutationInterceptor; import org.pitest.mutationtest.build.intercept.javafeatures.FilterTester; import org.pitest.mutationtest.engine.gregor.mutators.NullMutateEverything; -import org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; import java.util.List; import java.util.stream.Stream; @@ -16,7 +16,7 @@ public class NullFlatmapTest { MutationInterceptor testee = new NullFlatMapFilterFactory().createInterceptor(null); - FilterTester verifier = new FilterTester("", this.testee, NullReturnValsMutator.NULL_RETURN_VALUES, + FilterTester verifier = new FilterTester("", this.testee, NullReturnValsMutator.NULL_RETURNS, new NullMutateEverything()); @Test diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/EnumConstructorTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/EnumConstructorTest.java index 2cc075cc8..9c03352eb 100755 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/EnumConstructorTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/EnumConstructorTest.java @@ -4,13 +4,13 @@ import org.pitest.mutationtest.engine.MutationDetails; import java.util.function.Predicate; -import static org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR; +import static org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator.VOID_METHOD_CALLS; public class EnumConstructorTest { EnumConstructorFilter testee = new EnumConstructorFilter(); - FilterTester verifier = new FilterTester("unused", this.testee, VOID_METHOD_CALL_MUTATOR); + FilterTester verifier = new FilterTester("unused", this.testee, VOID_METHOD_CALLS); @Test public void filtersMutantsFromEnumConstructor() { diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/ForEachFilterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/ForEachFilterTest.java index 7391884b9..533026a33 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/ForEachFilterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/ForEachFilterTest.java @@ -26,34 +26,34 @@ public void declaresTypeAsFilter() { @Test public void filtersMutationsToForEachLoopJumps() { - this.verifier = new FilterTester(PATH, this.testee, NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR); + this.verifier = new FilterTester(PATH, this.testee, NegateConditionalsMutator.NEGATE_CONDITIONALS); this.verifier.assertFiltersNMutationFromSample(1, "HasForEachLoop"); } @Test public void filtersMutationsToHasNextAndNext() { - this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); // can mutate calls to iterator, hasNext and next this.verifier.assertFiltersNMutationFromSample(3, "HasForEachLoop"); } @Test public void filtersMutationsToForEachOverField() { - this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); // can mutate calls to iterator, hasNext and next this.verifier.assertFiltersNMutationFromClass(3, HasForEachLoopOverField.class); } @Test public void filtersMutationsToForEachOverMethodReturn() { - this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); // can mutate calls to iterator, hasNext and next this.verifier.assertFiltersNMutationFromClass(3, HasForEachLoopOverMethodReturn.class); } @Test public void filtersMutationsToForEachOverCollections() { - this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + this.verifier = new FilterTester(PATH, this.testee, NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); // can mutate calls to iterator, hasNext and next this.verifier.assertFiltersNMutationFromClass(3, HasForEachLoopOverCollection.class); } @@ -67,7 +67,7 @@ public void filtersMutationsToForEachOverArrays() { @Test public void doesNotFilterMutationsToIndexedForLoopJumps() { - this.verifier = new FilterTester("forloops/{0}_{1}", this.testee, NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR); + this.verifier = new FilterTester("forloops/{0}_{1}", this.testee, NegateConditionalsMutator.NEGATE_CONDITIONALS); this.verifier.assertFiltersNMutationFromSample(0, "HasAForLoop"); } diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/InlinedFinallyBlockFilterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/InlinedFinallyBlockFilterTest.java index cad024149..a7e5847bc 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/InlinedFinallyBlockFilterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/javafeatures/InlinedFinallyBlockFilterTest.java @@ -9,8 +9,8 @@ import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; -import static org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator.INCREMENTS_MUTATOR; -import static org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR; +import static org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator.INCREMENTS; +import static org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator.VOID_METHOD_CALLS; public class InlinedFinallyBlockFilterTest { @@ -20,7 +20,7 @@ public class InlinedFinallyBlockFilterTest { // omit aspectJ. Filter doesn't work correctly with it, but slack is picked up by the // try with resources filter asList("javac", "javac11", "ecj"), - VOID_METHOD_CALL_MUTATOR, INCREMENTS_MUTATOR); + VOID_METHOD_CALLS, INCREMENTS); @Test public void shouldDeclareTypeAsFilter() { @@ -35,19 +35,19 @@ public void doesNotFilterWhenNoFinallyBlock() { @Test public void combinesMutationsInSimpleFinallyBlocks() { verifier.assertFiltersNMutationFromClass(1, HasFinallyBlock.class); - verifier.assertCombinedMutantExists(forMutator(INCREMENTS_MUTATOR), HasFinallyBlock.class); + verifier.assertCombinedMutantExists(forMutator(INCREMENTS), HasFinallyBlock.class); } @Test public void combinesMutationsInFinallyBlocksWithExceptionHandlers() { verifier.assertFiltersNMutationFromClass(2, HasFinallyBlockAndExceptionHandler.class); - verifier.assertCombinedMutantExists(forMutator(INCREMENTS_MUTATOR), HasFinallyBlockAndExceptionHandler.class); + verifier.assertCombinedMutantExists(forMutator(INCREMENTS), HasFinallyBlockAndExceptionHandler.class); } @Test public void combinesSimilarMutationsInFinallyBlocksWhenOnDifferentLines() { verifier.assertFiltersNMutationFromClass(2, HasSimilarMutationsFinallyBlock.class); - verifier.assertCombinedMutantExists(forMutator(INCREMENTS_MUTATOR), HasSimilarMutationsFinallyBlock.class); + verifier.assertCombinedMutantExists(forMutator(INCREMENTS), HasSimilarMutationsFinallyBlock.class); } @Test diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/AvoidForLoopCounterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/AvoidForLoopCounterTest.java index 6cd599179..e351b2b48 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/AvoidForLoopCounterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/AvoidForLoopCounterTest.java @@ -17,7 +17,7 @@ public class AvoidForLoopCounterTest { AvoidForLoopCounterFilter testee = new AvoidForLoopCounterFilter(); private static final String PATH = "forloops/{0}_{1}"; - FilterTester verifier = new FilterTester(PATH, this.testee, IncrementsMutator.INCREMENTS_MUTATOR); + FilterTester verifier = new FilterTester(PATH, this.testee, IncrementsMutator.INCREMENTS); @Test diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteForLoopFilterFactoryTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteForLoopFilterFactoryTest.java index 67eb6b91b..385bc4498 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteForLoopFilterFactoryTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteForLoopFilterFactoryTest.java @@ -28,7 +28,7 @@ InfiniteLoopFilter testee() { @Test public void shouldFilterMutationsThatRemoveForLoopIncrement() { - GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR); + GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS); List mutations = mutator.findMutations(ClassName.fromClass(MutateMyForLoop.class)); assertThat(mutations).hasSize(2); @@ -41,7 +41,7 @@ public void shouldFilterMutationsThatRemoveForLoopIncrement() { @Test public void shouldNotFilterMutationsInMethodsThatAppearToAlreadyHaveInfiniteLoops() { - GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR); + GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS); // our analysis incorrectly identifies some loops as infinite - must skip these List mutations = mutator.findMutations(ClassName.fromClass(DontFilterMyAlreadyInfiniteLoop.class)); assertThat(mutations).hasSize(1); diff --git a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteIteratorLoopFilterTest.java b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteIteratorLoopFilterTest.java index 41bd3ab1b..0fb0684c1 100644 --- a/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteIteratorLoopFilterTest.java +++ b/pitest-entry/src/test/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteIteratorLoopFilterTest.java @@ -24,7 +24,7 @@ InfiniteIteratorLoopFilter testee() { @Test public void shouldNotFilterMutationsInMethodsThatAppearToAlreadyHaveInfiniteLoops() { - final GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR); + final GregorMutater mutator = createMutator(RemoveIncrementsMutator.REMOVE_INCREMENTS); // our analysis incorrectly identifies some loops as infinite - must skip these final List mutations = mutator.findMutations(ClassName.fromClass(DontFilterMyAlreadyInfiniteLoop.class)); assertThat(mutations).hasSize(1); @@ -38,7 +38,7 @@ public void shouldNotFilterMutationsInMethodsThatAppearToAlreadyHaveInfiniteLoop @Test public void shouldFilterMutationsThatRemoveIteratorNextCalls() { - final GregorMutater mutator = createMutator(NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + final GregorMutater mutator = createMutator(NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); final List mutations = mutator.findMutations(ClassName.fromClass(MutateMyForEachLoop.class)); assertThat(mutations).hasSize(3); diff --git a/pitest/src/main/java/org/pitest/coverage/execute/CoverageMinion.java b/pitest/src/main/java/org/pitest/coverage/execute/CoverageMinion.java index 9e5668304..bda24e679 100644 --- a/pitest/src/main/java/org/pitest/coverage/execute/CoverageMinion.java +++ b/pitest/src/main/java/org/pitest/coverage/execute/CoverageMinion.java @@ -31,7 +31,6 @@ import org.pitest.testapi.execute.FindTestUnits; import org.pitest.util.ExitCode; import org.pitest.util.Glob; -import org.pitest.util.IsolationUtils; import org.pitest.util.Log; import org.pitest.util.SafeDataInputStream; import sun.pitest.CodeCoverageStore; @@ -159,7 +158,7 @@ private static List discoverTests(final Configuration testPlugin, private static Configuration createTestPlugin( final CoverageOptions paramsFromParent) { - final ClientPluginServices plugins = new ClientPluginServices(IsolationUtils.getContextClassLoader()); + final ClientPluginServices plugins = ClientPluginServices.makeForContextLoader(); final MinionSettings factory = new MinionSettings(plugins); return factory.getTestFrameworkPlugin(paramsFromParent.getPitConfig(), ClassloaderByteArraySource.fromContext()); } diff --git a/pitest/src/main/java/org/pitest/mutationtest/config/ClientPluginServices.java b/pitest/src/main/java/org/pitest/mutationtest/config/ClientPluginServices.java index 0e2652f38..adab9639b 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/config/ClientPluginServices.java +++ b/pitest/src/main/java/org/pitest/mutationtest/config/ClientPluginServices.java @@ -18,7 +18,6 @@ public static ClientPluginServices makeForContextLoader() { return new ClientPluginServices(IsolationUtils.getContextClassLoader()); } - Collection findTestFrameworkPlugins() { return ServiceLoader.load(TestPluginFactory.class, this.loader); } diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutationContext.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutationContext.java index 74acfd172..ffe25a1d8 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutationContext.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutationContext.java @@ -59,7 +59,6 @@ public void registerCurrentLine(final int line) { @Override public void registerNewBlock() { this.classContext.registerNewBlock(); - } @Override diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java index e0f934d96..2b496ebdd 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java @@ -46,6 +46,9 @@ MethodVisitor create(MutationContext context, * MethodVisitor created by this * MethodMutatorFactory. * + * The name is also the key by which mutators are activated and deactivated. + * More than one MethodMutatorFactory instance might have the same name so + * they can be activated together. Their globalIds must however be unique. * * @return a human readable string representation for end-user report * generation. diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/Mutator.java index 5309e6f2b..5a8d95509 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/Mutator.java @@ -14,290 +14,61 @@ */ package org.pitest.mutationtest.engine.gregor.config; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.function.Function; - import org.pitest.functional.FCollection; import org.pitest.functional.prelude.Prelude; import org.pitest.help.Help; import org.pitest.help.PitHelpError; import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; -import org.pitest.mutationtest.engine.gregor.mutators.ArgumentPropagationMutator; -import org.pitest.mutationtest.engine.gregor.mutators.BooleanFalseReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.BooleanTrueReturnValsMutator; import org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator; -import org.pitest.mutationtest.engine.gregor.mutators.ConstructorCallMutator; -import org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator; import org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator; import org.pitest.mutationtest.engine.gregor.mutators.InvertNegsMutator; import org.pitest.mutationtest.engine.gregor.mutators.MathMutator; import org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator; -import org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.PrimitiveReturnsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator; -import org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator.Choice; import org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator; import org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator; -import org.pitest.mutationtest.engine.gregor.mutators.experimental.BigIntegerMutator; -import org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator; -import org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveIncrementsMutator; -import org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator; -import org.pitest.mutationtest.engine.gregor.mutators.experimental.SwitchMutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ABSMutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR3Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR4Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR3Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR4Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR5Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR6Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN3Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR3Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR4Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR5Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI1Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI2Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI3Mutator; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI4Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; +import org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator; +import org.pitest.util.IsolationUtils; +import org.pitest.util.ServiceLoader; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.function.Function; +import java.util.stream.Collectors; public final class Mutator { - private static final Map> MUTATORS = new LinkedHashMap<>(); + private static final Map> MUTATORS; static { + Collection mutatorFactories = ServiceLoader.load(MutatorGroup.class, IsolationUtils.getContextClassLoader()); - /* - * Default mutator that inverts the negation of integer and floating point - * numbers. - */ - add("INVERT_NEGS", InvertNegsMutator.INVERT_NEGS_MUTATOR); - - /* - * Default mutator that mutates the return values of methods. - */ - add("RETURN_VALS", ReturnValsMutator.RETURN_VALS_MUTATOR); - - /* - * Optional mutator that mutates integer and floating point inline - * constants. - */ - add("INLINE_CONSTS", new InlineConstantMutator()); - - /* - * Default mutator that mutates binary arithmetic operations. - */ - add("MATH", MathMutator.MATH_MUTATOR); - - /* - * Default mutator that removes method calls to void methods. - * - */ - add("VOID_METHOD_CALLS", VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR); - - /* - * Default mutator that negates conditionals. - */ - add("NEGATE_CONDITIONALS", - NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR); - - /* - * Default mutator that replaces the relational operators with their - * boundary counterpart. - */ - add("CONDITIONALS_BOUNDARY", - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR); - - /* - * Default mutator that mutates increments, decrements and assignment - * increments and decrements of local variables. - */ - add("INCREMENTS", IncrementsMutator.INCREMENTS_MUTATOR); - - /* - * Optional mutator that removes local variable increments. - */ - add("REMOVE_INCREMENTS", RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR); - - /* - * Optional mutator that removes method calls to non void methods. - */ - add("NON_VOID_METHOD_CALLS", - NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); - - /* - * Optional mutator that replaces constructor calls with null values. - */ - add("CONSTRUCTOR_CALLS", ConstructorCallMutator.CONSTRUCTOR_CALL_MUTATOR); - - /* - * Removes conditional statements so that guarded statements always execute - * The EQUAL version ignores LT,LE,GT,GE, which is the default behaviour, - * ORDER version mutates only those. - */ - add("REMOVE_CONDITIONALS_EQ_IF", new RemoveConditionalMutator(Choice.EQUAL, - true)); - add("REMOVE_CONDITIONALS_EQ_ELSE", new RemoveConditionalMutator( - Choice.EQUAL, false)); - add("REMOVE_CONDITIONALS_ORD_IF", new RemoveConditionalMutator( - Choice.ORDER, true)); - add("REMOVE_CONDITIONALS_ORD_ELSE", new RemoveConditionalMutator( - Choice.ORDER, false)); - addGroup("REMOVE_CONDITIONALS", RemoveConditionalMutator.makeMutators()); - - add("TRUE_RETURNS", BooleanTrueReturnValsMutator.BOOLEAN_TRUE_RETURN); - add("FALSE_RETURNS", BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN); - add("PRIMITIVE_RETURNS", PrimitiveReturnsMutator.PRIMITIVE_RETURN_VALS_MUTATOR); - add("EMPTY_RETURNS", EmptyObjectReturnValsMutator.EMPTY_RETURN_VALUES); - add("NULL_RETURNS", NullReturnValsMutator.NULL_RETURN_VALUES); - addGroup("RETURNS", betterReturns()); - - experimentalMutators(); - - researchMutators(); - - addGroup("REMOVE_SWITCH", RemoveSwitchMutator.makeMutators()); - addGroup("OLD_DEFAULTS", oldDefaults()); - addGroup("STRONGER", stronger()); - addGroup("ALL", all()); - addGroup("DEFAULTS", newDefaults()); - addGroup("AOR", aor()); - addGroup("AOD", aod()); - addGroup("CRCR", crcr()); - addGroup("OBBN", obbn()); - addGroup("ROR", ror()); - addGroup("UOI", uoi()); - - } - - /** - * Mutators that have not yet been battle tested - */ - private static void experimentalMutators() { - /* - * Experimental mutator that removed assignments to member variables. - */ - add("EXPERIMENTAL_MEMBER_VARIABLE", - new org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator()); - - /* - * Experimental mutator that swaps labels in switch statements - */ - add("EXPERIMENTAL_SWITCH", - new org.pitest.mutationtest.engine.gregor.mutators.experimental.SwitchMutator()); + Collection ms = ServiceLoader.load(MethodMutatorFactory.class, IsolationUtils.getContextClassLoader()); - /* - * Experimental mutator that replaces method call with one of its parameters - * of matching type - */ - add("EXPERIMENTAL_ARGUMENT_PROPAGATION", - ArgumentPropagationMutator.ARGUMENT_PROPAGATION_MUTATOR); + MUTATORS = ms.stream() + .collect(Collectors.groupingBy(MethodMutatorFactory::getName)); - /* - * Experimental mutator that replaces method call with this - */ - add("EXPERIMENTAL_NAKED_RECEIVER", NakedReceiverMutator.NAKED_RECEIVER); - - /* - * Experimental mutator that swaps big integer methods - */ - add("EXPERIMENTAL_BIG_INTEGER", BigIntegerMutator.INSTANCE); - } - - /** - * "Research" mutators that makeup "PITrv" as described in - * https://researchrepository.ucd.ie/bitstream/10197/7748/4/ISSTA_2016_Demo_Camera_ready.pdf - */ - private static void researchMutators() { - /* - * mutators that mutate binary arithmetic operations. - */ - add("AOR_1", AOR1Mutator.AOR_1_MUTATOR); - add("AOR_2", AOR2Mutator.AOR_2_MUTATOR); - add("AOR_3", AOR3Mutator.AOR_3_MUTATOR); - add("AOR_4", AOR4Mutator.AOR_4_MUTATOR); - - /* - * mutator that replaces a variable with its negation. - */ - add("ABS", ABSMutator.ABS_MUTATOR); - - /* - * mutators that replace a binary arithmetic operations with one of its members. - */ - add("AOD1", AOD1Mutator.AOD_1_MUTATOR); - add("AOD2", AOD2Mutator.AOD_2_MUTATOR); - - - /* - * mutators that replace an inline constant a with 0, 1, -1, a+1 or a-1 . - */ - add("CRCR1", CRCR1Mutator.CRCR_1_MUTATOR); - add("CRCR2", CRCR2Mutator.CRCR_2_MUTATOR); - add("CRCR3", CRCR3Mutator.CRCR_3_MUTATOR); - add("CRCR4", CRCR4Mutator.CRCR_4_MUTATOR); - add("CRCR5", CRCR5Mutator.CRCR_5_MUTATOR); - add("CRCR6", CRCR6Mutator.CRCR_6_MUTATOR); - - /* - * mutators that replace an bitwise ands and ors. - */ - add("OBBN1", OBBN1Mutator.OBBN_1_MUTATOR); - add("OBBN2", OBBN2Mutator.OBBN_2_MUTATOR); - add("OBBN3", OBBN3Mutator.OBBN_3_MUTATOR); - - /* - * mutators that replace conditional operators. - */ - add("ROR1", ROR1Mutator.ROR_1_MUTATOR); - add("ROR2", ROR2Mutator.ROR_2_MUTATOR); - add("ROR3", ROR3Mutator.ROR_3_MUTATOR); - add("ROR4", ROR4Mutator.ROR_4_MUTATOR); - add("ROR5", ROR5Mutator.ROR_5_MUTATOR); - - /* - * mutators that insert increments. - */ - add("UOI1", UOI1Mutator.UOI_1_MUTATOR); - add("UOI2", UOI2Mutator.UOI_2_MUTATOR); - add("UOI3", UOI3Mutator.UOI_3_MUTATOR); - add("UOI4", UOI4Mutator.UOI_4_MUTATOR); + mutatorFactories.stream() + .forEach(m -> m.register(MUTATORS)); } public static Collection all() { - return fromStrings(MUTATORS.keySet()); + return fromStrings(allMutatorIds()); } public static Collection allMutatorIds() { return MUTATORS.keySet(); } - private static Collection stronger() { - return combine( - newDefaults(), - group(new RemoveConditionalMutator(Choice.EQUAL, false), - new SwitchMutator())); - } - private static Collection combine( Collection a, Collection b) { final List l = new ArrayList<>(a); @@ -310,75 +81,33 @@ private static Collection combine( * performance */ public static Collection oldDefaults() { - return group(InvertNegsMutator.INVERT_NEGS_MUTATOR, - ReturnValsMutator.RETURN_VALS_MUTATOR, MathMutator.MATH_MUTATOR, - VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR, - NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR, - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR, - IncrementsMutator.INCREMENTS_MUTATOR); + return group(InvertNegsMutator.INVERT_NEGS, + ReturnValsMutator.RETURN_VALS, MathMutator.MATH, + VoidMethodCallMutator.VOID_METHOD_CALLS, + NegateConditionalsMutator.NEGATE_CONDITIONALS, + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY, + IncrementsMutator.INCREMENTS); } /** * Proposed new defaults - replaced the RETURN_VALS mutator with the new more stable set */ public static Collection newDefaults() { - return combine(group(InvertNegsMutator.INVERT_NEGS_MUTATOR, - MathMutator.MATH_MUTATOR, - VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR, - NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR, - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR, - IncrementsMutator.INCREMENTS_MUTATOR), betterReturns()); - } - - - public static Collection betterReturns() { - return group(BooleanTrueReturnValsMutator.BOOLEAN_TRUE_RETURN, - BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN, - PrimitiveReturnsMutator.PRIMITIVE_RETURN_VALS_MUTATOR, - EmptyObjectReturnValsMutator.EMPTY_RETURN_VALUES, - NullReturnValsMutator.NULL_RETURN_VALUES); - } - - public static Collection aor() { - return group(AOR1Mutator.AOR_1_MUTATOR, - AOR2Mutator.AOR_2_MUTATOR, - AOR3Mutator.AOR_3_MUTATOR, - AOR4Mutator.AOR_4_MUTATOR); - } - - public static Collection aod() { - return group(AOD1Mutator.AOD_1_MUTATOR, - AOD2Mutator.AOD_2_MUTATOR); + return combine(group(InvertNegsMutator.INVERT_NEGS, + MathMutator.MATH, + VoidMethodCallMutator.VOID_METHOD_CALLS, + NegateConditionalsMutator.NEGATE_CONDITIONALS, + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY, + IncrementsMutator.INCREMENTS), betterReturns()); } - public static Collection crcr() { - return group(CRCR1Mutator.CRCR_1_MUTATOR, - CRCR2Mutator.CRCR_2_MUTATOR, - CRCR3Mutator.CRCR_3_MUTATOR, - CRCR4Mutator.CRCR_4_MUTATOR, - CRCR5Mutator.CRCR_5_MUTATOR, - CRCR6Mutator.CRCR_6_MUTATOR); - } - - public static Collection obbn() { - return group(OBBN1Mutator.OBBN_1_MUTATOR, - OBBN2Mutator.OBBN_2_MUTATOR, - OBBN3Mutator.OBBN_3_MUTATOR); - } - - public static Collection ror() { - return group(ROR1Mutator.ROR_1_MUTATOR, - ROR2Mutator.ROR_2_MUTATOR, - ROR3Mutator.ROR_3_MUTATOR, - ROR4Mutator.ROR_4_MUTATOR, - ROR5Mutator.ROR_5_MUTATOR); - } - public static Collection uoi() { - return group(UOI1Mutator.UOI_1_MUTATOR, - UOI2Mutator.UOI_2_MUTATOR, - UOI3Mutator.UOI_3_MUTATOR, - UOI4Mutator.UOI_4_MUTATOR); + private static Collection betterReturns() { + return group(BooleanTrueReturnValsMutator.TRUE_RETURNS, + BooleanFalseReturnValsMutator.FALSE_RETURNS, + PrimitiveReturnsMutator.PRIMITIVE_RETURNS, + EmptyObjectReturnValsMutator.EMPTY_RETURNS, + NullReturnValsMutator.NULL_RETURNS); } private static Collection group( @@ -391,20 +120,11 @@ public static Collection byName(final String name) { Prelude.id(MethodMutatorFactory.class)); } - private static void add(final String key, final MethodMutatorFactory value) { - MUTATORS.put(key, Collections.singleton(value)); - } - - private static void addGroup(final String key, - final Iterable value) { - MUTATORS.put(key, value); - } - public static Collection fromStrings( final Collection names) { - final Set unique = new TreeSet<>(compareId()); - FCollection.flatMapTo(names, fromString(), unique); + final Set unique = new TreeSet<>(compareId()); + FCollection.flatMapTo(names, fromString(MUTATORS), unique); return unique; } @@ -412,9 +132,14 @@ private static Comparator compareId() { return Comparator.comparing(MethodMutatorFactory::getGloballyUniqueId); } - private static Function> fromString() { + private static Function> fromString(Map> mutators) { return a -> { - final Iterable i = MUTATORS.get(a); + + if (a.equals("ALL")) { + return all(); + } + + final Iterable i = mutators.get(a); if (i == null) { throw new PitHelpError(Help.UNKNOWN_MUTATOR, a); } diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/MutatorGroup.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/MutatorGroup.java new file mode 100644 index 000000000..b6e42bdba --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/MutatorGroup.java @@ -0,0 +1,18 @@ +package org.pitest.mutationtest.engine.gregor.config; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public interface MutatorGroup { + void register(Map> mutators); + + default List gather(Map> mutators, String...keys) { + return Arrays.stream(keys) + .flatMap(k -> mutators.get(k).stream()) + .collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/StandardMutatorGroups.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/StandardMutatorGroups.java new file mode 100644 index 000000000..80e204caf --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/config/StandardMutatorGroups.java @@ -0,0 +1,33 @@ +package org.pitest.mutationtest.engine.gregor.config; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; + +import java.util.List; +import java.util.Map; + +public class StandardMutatorGroups implements MutatorGroup { + @Override + public void register(Map> mutators) { + + mutators.put("OLD_DEFAULTS", gather(mutators,"INVERT_NEGS", + "RETURN_VALS", + "MATH", + "VOID_METHOD_CALLS", + "NEGATE_CONDITIONALS", + "CONDITIONALS_BOUNDARY", + "INCREMENTS")); + + mutators.put("DEFAULTS", gather(mutators,"INVERT_NEGS", + "MATH", + "VOID_METHOD_CALLS", + "NEGATE_CONDITIONALS", + "CONDITIONALS_BOUNDARY", + "INCREMENTS", "RETURNS")); + + mutators.put("STRONGER", gather(mutators,"DEFAULTS", + "EXPERIMENTAL_SWITCH", + "REMOVE_CONDITIONALS_EQUAL_ELSE")); + + } + +} diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutator.java index 463fb28b3..65f0265c1 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutator.java @@ -26,7 +26,7 @@ public enum ConditionalsBoundaryMutator implements MethodMutatorFactory { - CONDITIONALS_BOUNDARY_MUTATOR; + CONDITIONALS_BOUNDARY; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutator.java index 37d3c212c..7d86f8057 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutator.java @@ -24,7 +24,7 @@ public enum ConstructorCallMutator implements MethodMutatorFactory { - CONSTRUCTOR_CALL_MUTATOR; + CONSTRUCTOR_CALLS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutator.java index 23f7704d9..93c512df4 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutator.java @@ -23,7 +23,7 @@ public enum IncrementsMutator implements MethodMutatorFactory { - INCREMENTS_MUTATOR; + INCREMENTS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutator.java index ab3625229..5334e6385 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutator.java @@ -298,7 +298,7 @@ public String getGloballyUniqueId() { @Override public String toString() { - return "INLINE_CONSTANT_MUTATOR"; + return "INLINE_CONSTS"; } @Override diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutator.java index 1ab9f3bd8..fdbdf60b8 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutator.java @@ -28,7 +28,7 @@ public enum InvertNegsMutator implements MethodMutatorFactory { - INVERT_NEGS_MUTATOR; + INVERT_NEGS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutator.java index b4551e8d9..5d0f07887 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutator.java @@ -28,7 +28,7 @@ public enum MathMutator implements MethodMutatorFactory { - MATH_MUTATOR; + MATH; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutator.java index 12c4ba170..83864c32b 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutator.java @@ -26,7 +26,7 @@ public enum NegateConditionalsMutator implements MethodMutatorFactory { - NEGATE_CONDITIONALS_MUTATOR; + NEGATE_CONDITIONALS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutator.java index 0056e3c76..14c78e0e0 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutator.java @@ -24,7 +24,7 @@ public enum NonVoidMethodCallMutator implements MethodMutatorFactory { - NON_VOID_METHOD_CALL_MUTATOR; + NON_VOID_METHOD_CALLS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutator.java index 7c3952de7..38a9d1b61 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutator.java @@ -39,7 +39,7 @@ public RemoveConditionalMutator(final Choice c, final boolean rc) { this.replaceWith = rc; } - public static Iterable makeMutators() { + public static Iterable factory() { final List variations = new ArrayList<>(); final Choice[] allChoices = { Choice.EQUAL, Choice.ORDER }; final boolean[] arrWith = { true, false }; @@ -68,7 +68,11 @@ public String getGloballyUniqueId() { @Override public String getName() { return "REMOVE_CONDITIONALS_" + this.kind + "_" - + (this.replaceWith ? "IF" : "ELSE") + "_MUTATOR"; + + (this.replaceWith ? "IF" : "ELSE"); + } + + public String toString() { + return getName(); } private final class RemoveConditionalMethodVisitor extends MethodVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorGroup.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorGroup.java new file mode 100644 index 000000000..4ff1035d1 --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorGroup.java @@ -0,0 +1,22 @@ +package org.pitest.mutationtest.engine.gregor.mutators; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; +import org.pitest.mutationtest.engine.gregor.config.MutatorGroup; + +import java.util.List; +import java.util.Map; + +public class RemoveConditionalMutatorGroup implements MutatorGroup { + + @Override + public void register(Map> mutators) { + mutators.put("REMOVE_CONDITIONALS", + gather(mutators,"REMOVE_CONDITIONALS_EQUAL_IF", + "REMOVE_CONDITIONALS_EQUAL_IF", + "REMOVE_CONDITIONALS_EQUAL_ELSE", + "REMOVE_CONDITIONALS_ORDER_IF", + "REMOVE_CONDITIONALS_ORDER_ELSE")); + + } + +} diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutator.java index a9835922f..bb22ad90f 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutator.java @@ -34,9 +34,10 @@ import org.pitest.mutationtest.engine.gregor.MutationContext; import org.pitest.mutationtest.engine.gregor.ZeroOperandMutation; +@Deprecated public enum ReturnValsMutator implements MethodMutatorFactory { - RETURN_VALS_MUTATOR; + RETURN_VALS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutator.java index 2f5496ebe..2096b773f 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutator.java @@ -24,7 +24,7 @@ public enum VoidMethodCallMutator implements MethodMutatorFactory { - VOID_METHOD_CALL_MUTATOR; + VOID_METHOD_CALLS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationMutator.java similarity index 94% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationMutator.java index 1dc6706db..9e9b6481f 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationMutator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.experimental; import org.objectweb.asm.MethodVisitor; import org.pitest.mutationtest.engine.gregor.MethodInfo; @@ -47,7 +47,7 @@ */ public enum ArgumentPropagationMutator implements MethodMutatorFactory { - ARGUMENT_PROPAGATION_MUTATOR; + EXPERIMENTAL_ARGUMENT_PROPAGATION; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationVisitor.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationVisitor.java similarity index 98% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationVisitor.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationVisitor.java index c04680f7d..c9359b93a 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationVisitor.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/ArgumentPropagationVisitor.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.experimental; import static java.util.Arrays.asList; import static org.objectweb.asm.Opcodes.DUP2_X1; diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/BigIntegerMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/BigIntegerMutator.java index 664d0d2a6..968b5c048 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/BigIntegerMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/BigIntegerMutator.java @@ -12,7 +12,7 @@ import org.pitest.mutationtest.engine.gregor.MutationContext; public enum BigIntegerMutator implements MethodMutatorFactory { - INSTANCE; + EXPERIMENTAL_BIG_INTEGER; @Override public MethodVisitor create(MutationContext context, MethodInfo info, MethodVisitor visitor) { @@ -26,7 +26,7 @@ public String getGloballyUniqueId() { @Override public String toString() { - return "EXPERIMENTAL_BIGINTEGER_MUTATOR"; + return "EXPERIMENTAL_BIG_INTEGER"; } @Override diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutator.java index ff6fbb0c7..9dbd9348f 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutator.java @@ -95,7 +95,7 @@ public String getGloballyUniqueId() { @Override public String toString() { - return "EXPERIMENTAL_MEMBER_VARIABLE_MUTATOR"; + return "EXPERIMENTAL_MEMBER_VARIABLE"; } @Override diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutator.java index 5f35d4159..9e321fbfe 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutator.java @@ -47,7 +47,7 @@ */ public enum NakedReceiverMutator implements MethodMutatorFactory { - NAKED_RECEIVER; + EXPERIMENTAL_NAKED_RECEIVER; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutator.java index 9a19f575b..89b7c1b93 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutator.java @@ -24,7 +24,7 @@ public enum RemoveIncrementsMutator implements MethodMutatorFactory { - REMOVE_INCREMENTS_MUTATOR; + REMOVE_INCREMENTS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutator.java index 73e829acd..b1e8605f1 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutator.java @@ -1,8 +1,5 @@ package org.pitest.mutationtest.engine.gregor.mutators.experimental; -import java.util.ArrayList; -import java.util.List; - import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.pitest.bytecode.ASMVersion; @@ -11,6 +8,9 @@ import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; import org.pitest.mutationtest.engine.gregor.MutationContext; +import java.util.ArrayList; +import java.util.List; + /** * Remove switch statements. We get an array of labels to jump to, plus a * default label. We change each label to the default label, thus removing it @@ -27,7 +27,7 @@ public class RemoveSwitchMutator implements MethodMutatorFactory { this.key = i; } - public static Iterable makeMutators() { + static List makeMutators() { final List variations = new ArrayList<>(); for (int i = GENERATE_FROM_INCLUDING; i != GENERATE_UPTO_EXCLUDING; i++) { variations.add(new RemoveSwitchMutator(i)); diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutatorGroup.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutatorGroup.java new file mode 100644 index 000000000..aedff813a --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveSwitchMutatorGroup.java @@ -0,0 +1,14 @@ +package org.pitest.mutationtest.engine.gregor.mutators.experimental; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; +import org.pitest.mutationtest.engine.gregor.config.MutatorGroup; + +import java.util.List; +import java.util.Map; + +public class RemoveSwitchMutatorGroup implements MutatorGroup { + @Override + public void register(Map> mutators) { + mutators.put("REMOVE_SWITCH", RemoveSwitchMutator.makeMutators()); + } +} diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutator.java index 3812676bf..63c114915 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutator.java @@ -29,7 +29,7 @@ public String getGloballyUniqueId() { @Override public String getName() { - return "EXPERIMENTAL_SWITCH_MUTATOR"; + return "EXPERIMENTAL_SWITCH"; } private final class SwitchMethodVisitor extends MethodVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanFalseReturnValsMutator.java similarity index 97% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanFalseReturnValsMutator.java index 6bec3c4d7..e86286d7b 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanFalseReturnValsMutator.java @@ -1,4 +1,4 @@ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.returns; import static org.objectweb.asm.Opcodes.ARETURN; import static org.objectweb.asm.Opcodes.IRETURN; @@ -21,7 +21,7 @@ */ public enum BooleanFalseReturnValsMutator implements MethodMutatorFactory { - BOOLEAN_FALSE_RETURN; + FALSE_RETURNS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanTrueReturnValsMutator.java similarity index 97% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanTrueReturnValsMutator.java index 65eeaf842..c2fd7f6d5 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/BooleanTrueReturnValsMutator.java @@ -1,4 +1,4 @@ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.returns; import static org.objectweb.asm.Opcodes.ARETURN; import static org.objectweb.asm.Opcodes.IRETURN; @@ -18,7 +18,7 @@ public enum BooleanTrueReturnValsMutator implements MethodMutatorFactory { - BOOLEAN_TRUE_RETURN; + TRUE_RETURNS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/EmptyObjectReturnValsMutator.java similarity index 99% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/EmptyObjectReturnValsMutator.java index 36e737aef..227ef4808 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/EmptyObjectReturnValsMutator.java @@ -1,4 +1,4 @@ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.returns; import java.util.Collections; import java.util.HashMap; @@ -24,7 +24,7 @@ */ public enum EmptyObjectReturnValsMutator implements MethodMutatorFactory { - EMPTY_RETURN_VALUES; + EMPTY_RETURNS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/NullReturnValsMutator.java similarity index 97% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/NullReturnValsMutator.java index fdcfb53eb..5cbc9d119 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/NullReturnValsMutator.java @@ -1,4 +1,4 @@ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.returns; import java.util.Collections; import java.util.Map; @@ -23,7 +23,7 @@ */ public enum NullReturnValsMutator implements MethodMutatorFactory { - NULL_RETURN_VALUES; + NULL_RETURNS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnsMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/PrimitiveReturnsMutator.java similarity index 98% rename from pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnsMutator.java rename to pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/PrimitiveReturnsMutator.java index b9c59d25c..27abe46c4 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnsMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/PrimitiveReturnsMutator.java @@ -1,4 +1,4 @@ -package org.pitest.mutationtest.engine.gregor.mutators; +package org.pitest.mutationtest.engine.gregor.mutators.returns; import static org.objectweb.asm.Opcodes.DRETURN; import static org.objectweb.asm.Opcodes.FRETURN; @@ -23,7 +23,7 @@ */ public enum PrimitiveReturnsMutator implements MethodMutatorFactory { - PRIMITIVE_RETURN_VALS_MUTATOR; + PRIMITIVE_RETURNS; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/ReturnsMutatorGroup.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/ReturnsMutatorGroup.java new file mode 100644 index 000000000..b00aa6a3f --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/returns/ReturnsMutatorGroup.java @@ -0,0 +1,20 @@ +package org.pitest.mutationtest.engine.gregor.mutators.returns; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; +import org.pitest.mutationtest.engine.gregor.config.MutatorGroup; + +import java.util.List; +import java.util.Map; + +public class ReturnsMutatorGroup implements MutatorGroup { + @Override + public void register(Map> mutators) { + mutators.put("RETURNS", + gather(mutators,"TRUE_RETURNS", + "FALSE_RETURNS", + "PRIMITIVE_RETURNS", + "EMPTY_RETURNS", + "NULL_RETURNS")); + + } +} diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutator.java index a7ce6fe62..f292785e8 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutator.java @@ -17,7 +17,7 @@ */ public enum ABSMutator implements MethodMutatorFactory { - ABS_MUTATOR; + ABS; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1Mutator.java index 586f93504..b8bae1b86 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1Mutator.java @@ -14,7 +14,7 @@ */ public enum AOD1Mutator implements MethodMutatorFactory { - AOD_1_MUTATOR; + AOD1; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2Mutator.java index 2767bdd74..fd9b5824e 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2Mutator.java @@ -16,7 +16,7 @@ */ public enum AOD2Mutator implements MethodMutatorFactory { - AOD_2_MUTATOR; + AOD2; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { return new AODMethodVisitor2(this, context, methodInfo, methodVisitor); diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1Mutator.java index c73efcea5..4a4c6dddd 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1Mutator.java @@ -28,7 +28,7 @@ public enum AOR1Mutator implements MethodMutatorFactory { - AOR_1_MUTATOR; + AOR1; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2Mutator.java index 02ccba8e2..8299d996d 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2Mutator.java @@ -28,7 +28,7 @@ public enum AOR2Mutator implements MethodMutatorFactory { - AOR_2_MUTATOR; + AOR2; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3Mutator.java index 7c27e74bb..a9b13355a 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3Mutator.java @@ -28,7 +28,7 @@ public enum AOR3Mutator implements MethodMutatorFactory { - AOR_3_MUTATOR; + AOR3; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4Mutator.java index d249b26d7..234eb9620 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4Mutator.java @@ -28,7 +28,7 @@ public enum AOR4Mutator implements MethodMutatorFactory { - AOR_4_MUTATOR; + AOR4; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Mutator.java index a7ca0c6b1..18eb62efa 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Mutator.java @@ -11,7 +11,7 @@ */ public enum CRCR1Mutator implements MethodMutatorFactory { - CRCR_1_MUTATOR; + CRCR1; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Mutator.java index 5cf757068..f6a4bdc79 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Mutator.java @@ -11,7 +11,7 @@ */ public enum CRCR2Mutator implements MethodMutatorFactory { - CRCR_2_MUTATOR; + CRCR2; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Mutator.java index c3fe1ca54..b55f0fba5 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Mutator.java @@ -11,7 +11,7 @@ */ public enum CRCR3Mutator implements MethodMutatorFactory { - CRCR_3_MUTATOR; + CRCR3; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Mutator.java index be6eb6bc1..ddfecb6e7 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Mutator.java @@ -11,7 +11,7 @@ */ public enum CRCR4Mutator implements MethodMutatorFactory { - CRCR_4_MUTATOR; + CRCR4; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Mutator.java index cf4415b88..251ea8da6 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Mutator.java @@ -12,7 +12,7 @@ */ public enum CRCR5Mutator implements MethodMutatorFactory { - CRCR_5_MUTATOR; + CRCR5; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Mutator.java index 4011f54dd..3060f3406 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Mutator.java @@ -12,7 +12,7 @@ */ public enum CRCR6Mutator implements MethodMutatorFactory { - CRCR_6_MUTATOR; + CRCR6; private final class CRCRVisitor1 extends AbstractCRCRVisitor { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1Mutator.java index f984f16f6..252c14dde 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1Mutator.java @@ -17,7 +17,7 @@ */ public enum OBBN1Mutator implements MethodMutatorFactory { - OBBN_1_MUTATOR; + OBBN1; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2Mutator.java index 0290e5fff..c086ba9d5 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2Mutator.java @@ -13,7 +13,7 @@ */ public enum OBBN2Mutator implements MethodMutatorFactory { - OBBN_2_MUTATOR; + OBBN2; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3Mutator.java index 6a604a96e..1a76ad2d8 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3Mutator.java @@ -15,7 +15,7 @@ */ public enum OBBN3Mutator implements MethodMutatorFactory { - OBBN_3_MUTATOR; + OBBN3; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1Mutator.java index 505ed630c..5dc78a36f 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1Mutator.java @@ -26,7 +26,7 @@ public enum ROR1Mutator implements MethodMutatorFactory { - ROR_1_MUTATOR; + ROR1; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2Mutator.java index d10bca04b..1860316ec 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2Mutator.java @@ -26,7 +26,7 @@ public enum ROR2Mutator implements MethodMutatorFactory { - ROR_2_MUTATOR; + ROR2; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3Mutator.java index 8a4037617..ee82eeb40 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3Mutator.java @@ -26,7 +26,7 @@ public enum ROR3Mutator implements MethodMutatorFactory { - ROR_3_MUTATOR; + ROR3; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4Mutator.java index 0d08f7cc7..863e0c4e9 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4Mutator.java @@ -26,7 +26,7 @@ public enum ROR4Mutator implements MethodMutatorFactory { - ROR_4_MUTATOR; + ROR4; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5Mutator.java index 529bde2e1..6a58528e4 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5Mutator.java @@ -26,7 +26,7 @@ public enum ROR5Mutator implements MethodMutatorFactory { - ROR_5_MUTATOR; + ROR5; @Override public MethodVisitor create(final MutationContext context, diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/RVMutatorGroups.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/RVMutatorGroups.java new file mode 100644 index 000000000..861b21512 --- /dev/null +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/RVMutatorGroups.java @@ -0,0 +1,42 @@ +package org.pitest.mutationtest.engine.gregor.mutators.rv; + +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; +import org.pitest.mutationtest.engine.gregor.config.MutatorGroup; + +import java.util.List; +import java.util.Map; + +public class RVMutatorGroups implements MutatorGroup { + @Override + public void register(Map> mutators) { + /* + * mutators that mutate binary arithmetic operations. + */ + mutators.put("AOR", gather(mutators,"AOR1", "AOR2", "AOR3", "AOR4")); + + /* + * mutators that replace a binary arithmetic operations with one of its members. + */ + mutators.put("AOD", gather(mutators,"AOD1", "AOD2")); + + /* + * mutators that replace an inline constant a with 0, 1, -1, a+1 or a-1 . + */ + mutators.put("CRCR", gather(mutators,"CRCR1", "CRCR2", "CRCR3", "CRCR4", + "CRCR5", "CRCR6")); + /* + * mutators that replace an bitwise ands and ors. + */ + mutators.put("OBBN", gather(mutators,"OBBN1", "OBBN2", "OBBN3")); + + /* + * mutators that replace conditional operators. + */ + mutators.put("ROR", gather(mutators,"ROR1", "ROR2", "ROR3", "ROR4", "ROR5")); + + /* + * mutators that insert increments. + */ + mutators.put("UOI", gather(mutators,"UOI1", "UOI2", "UOI3", "UOI4")); + } +} diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1Mutator.java index f3820b046..7d83a9a8e 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1Mutator.java @@ -13,7 +13,7 @@ */ public enum UOI1Mutator implements MethodMutatorFactory { - UOI_1_MUTATOR; + UOI1; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { return new UOI1MethodVisitor(this, context, methodVisitor); diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2Mutator.java index 97a79608d..2c95cb54d 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2Mutator.java @@ -13,7 +13,7 @@ */ public enum UOI2Mutator implements MethodMutatorFactory { - UOI_2_MUTATOR; + UOI2; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { return new UOI2MethodVisitor(this, context, methodVisitor); diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3Mutator.java index 26bad2785..268f5495c 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3Mutator.java @@ -13,7 +13,7 @@ */ public enum UOI3Mutator implements MethodMutatorFactory { - UOI_3_MUTATOR; + UOI3; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4Mutator.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4Mutator.java index 3b8203bde..7b57a7b6a 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4Mutator.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4Mutator.java @@ -13,7 +13,7 @@ */ public enum UOI4Mutator implements MethodMutatorFactory { - UOI_4_MUTATOR; + UOI4; public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo, final MethodVisitor methodVisitor) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/execute/MutationTestMinion.java b/pitest/src/main/java/org/pitest/mutationtest/execute/MutationTestMinion.java index 886e3612e..904caf539 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/execute/MutationTestMinion.java +++ b/pitest/src/main/java/org/pitest/mutationtest/execute/MutationTestMinion.java @@ -131,7 +131,7 @@ public static void main(final String[] args) { final Reporter reporter = new DefaultReporter(s.getOutputStream()); addMemoryWatchDog(reporter); - final ClientPluginServices plugins = new ClientPluginServices(IsolationUtils.getContextClassLoader()); + final ClientPluginServices plugins = ClientPluginServices.makeForContextLoader(); final MinionSettings factory = new MinionSettings(plugins); final MutationTestMinion instance = new MutationTestMinion(factory, dis, reporter); instance.run(); diff --git a/pitest/src/main/java/org/pitest/util/ServiceLoader.java b/pitest/src/main/java/org/pitest/util/ServiceLoader.java index 1f6cb2fc0..6e2b7453c 100644 --- a/pitest/src/main/java/org/pitest/util/ServiceLoader.java +++ b/pitest/src/main/java/org/pitest/util/ServiceLoader.java @@ -5,6 +5,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -64,7 +66,37 @@ private static void createServicesFromStream(final Class ifc, if (name.length() == 0) { continue; } - services.add(createService(name, ifc, loader)); + if (hasFactory(name, ifc, loader)) { + services.addAll(createServices(name, ifc, loader)); + } else { + services.add(createService(name, ifc, loader)); + } + } + } + + private static Collection createServices(String name, Class ifc, ClassLoader loader) { + + try { + final Class clz = Class.forName(name, true, loader); + Method method = clz.getMethod("factory"); + Object services = method.invoke(null); + return (Collection) services; + } catch (ReflectiveOperationException ex) { + throw new PitError("Error creating service " + ifc.getName(), ex); + } + } + + private static boolean hasFactory(String name, Class ifc, ClassLoader loader) { + try { + final Class clz = Class.forName(name, true, loader); + try { + Method method = clz.getMethod("factory"); + return Modifier.isStatic(method.getModifiers()); + } catch (NoSuchMethodException e) { + return false; + } + } catch (ClassNotFoundException ex) { + throw new PitError("Error creating service " + ifc.getName(), ex); } } @@ -72,6 +104,9 @@ private static S createService(final String name, final Class ifc, final ClassLoader loader) { try { final Class clz = Class.forName(name, true, loader); + if (Enum.class.isAssignableFrom(clz)) { + return firstEnumInstance((Class) clz); + } final Class impl = clz.asSubclass(ifc); final Constructor ctor = impl.getConstructor(); return ctor.newInstance(); @@ -80,4 +115,8 @@ private static S createService(final String name, final Class ifc, } } + private static S firstEnumInstance(Class clz) { + return (S) clz.getEnumConstants()[0]; + } + } diff --git a/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.MethodMutatorFactory b/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.MethodMutatorFactory new file mode 100644 index 000000000..dc3db2134 --- /dev/null +++ b/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.MethodMutatorFactory @@ -0,0 +1,51 @@ +org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator +org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator +org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator +org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator +org.pitest.mutationtest.engine.gregor.mutators.ConstructorCallMutator +org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator +org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator +org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator +org.pitest.mutationtest.engine.gregor.mutators.InvertNegsMutator +org.pitest.mutationtest.engine.gregor.mutators.MathMutator +org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator +org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator +org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator +org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator +org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator +org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator +org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.BigIntegerMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveIncrementsMutator +# Remove switch only added as a group +#org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.ReturnValuesMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.SwitchMutator +org.pitest.mutationtest.engine.gregor.mutators.experimental.BigIntegerMutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ABSMutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOD1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOD2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOR1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOR2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOR3Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.AOR4Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR3Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR4Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR5Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR6Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN3Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ROR1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ROR2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ROR3Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ROR4Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.ROR5Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.UOI1Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.UOI2Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.UOI3Mutator +org.pitest.mutationtest.engine.gregor.mutators.rv.UOI4Mutator diff --git a/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.config.MutatorGroup b/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.config.MutatorGroup new file mode 100644 index 000000000..4f15e72c7 --- /dev/null +++ b/pitest/src/main/resources/META-INF/services/org.pitest.mutationtest.engine.gregor.config.MutatorGroup @@ -0,0 +1,6 @@ +org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutatorGroup +org.pitest.mutationtest.engine.gregor.mutators.returns.ReturnsMutatorGroup +org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutatorGroup +org.pitest.mutationtest.engine.gregor.mutators.rv.RVMutatorGroups + +org.pitest.mutationtest.engine.gregor.config.StandardMutatorGroups \ No newline at end of file diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/GregorMutationEngineTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/GregorMutationEngineTest.java index 872d51794..be4b49f32 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/GregorMutationEngineTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/GregorMutationEngineTest.java @@ -37,8 +37,8 @@ public void shouldReportNamesOfSuppliedMutators() { i -> true, mutators); this.testee = new GregorMutationEngine(config); assertEquals(Arrays.asList( - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.getName(), - MathMutator.MATH_MUTATOR.getName()), this.testee.getMutatorNames()); + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY.getName(), + MathMutator.MATH.getName()), this.testee.getMutatorNames()); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/TestGregorMutater.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/TestGregorMutater.java index 2c8bca291..dd50c82b0 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/TestGregorMutater.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/TestGregorMutater.java @@ -25,11 +25,9 @@ import java.util.Collection; import java.util.List; -import java.util.function.Predicate; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class TestGregorMutater extends MutatorTestBase { @@ -49,10 +47,10 @@ public int mutable() { @Test public void shouldFindMutationsFromAllSuppliedMutators() throws Exception { - createTesteeWith(MathMutator.MATH_MUTATOR, - ReturnValsMutator.RETURN_VALS_MUTATOR, - InvertNegsMutator.INVERT_NEGS_MUTATOR, - IncrementsMutator.INCREMENTS_MUTATOR); + createTesteeWith(MathMutator.MATH, + ReturnValsMutator.RETURN_VALS, + InvertNegsMutator.INVERT_NEGS, + IncrementsMutator.INCREMENTS); final List actualDetails = findMutationsFor(HasMultipleMutations.class); diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/config/MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/config/MutatorTest.java index a7d3d7917..584593ea9 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/config/MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/config/MutatorTest.java @@ -16,25 +16,242 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode; -import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.stream.Collectors; import org.junit.Test; import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; -import org.pitest.mutationtest.engine.gregor.mutators.ArgumentPropagationMutator; +import org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator; import org.pitest.mutationtest.engine.gregor.mutators.InvertNegsMutator; import org.pitest.mutationtest.engine.gregor.mutators.MathMutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ABSMutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR3Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR4Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR3Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR4Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR5Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR6Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN3Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR3Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR4Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR5Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI1Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI2Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI3Mutator; +import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI4Mutator; public class MutatorTest { + @Test + public void providesINVERT_NEGS() { + assertProvides("INVERT_NEGS"); + } + + @Test + public void providesRETURN_VALS() { + assertProvides("RETURN_VALS"); + } + + @Test + public void providesINLINE_CONSTS() { + assertProvides("INLINE_CONSTS"); + } + + @Test + public void providesMATH() { + assertProvides("MATH"); + } + + @Test + public void providesVOID_METHOD_CALLS() { + assertProvides("VOID_METHOD_CALLS"); + } + + @Test + public void providesNEGATE_CONDITIONALS() { + assertProvides("NEGATE_CONDITIONALS"); + } + + @Test + public void providesCONDITIONALS_BOUNDARY() { + assertProvides("CONDITIONALS_BOUNDARY"); + } + + @Test + public void providesINCREMENTS() { + assertProvides("INCREMENTS"); + } + + @Test + public void providesREMOVE_INCREMENTS() { + assertProvides("REMOVE_INCREMENTS"); + } + + @Test + public void providesNON_VOID_METHOD_CALLS() { + assertProvides("NON_VOID_METHOD_CALLS"); + } + + @Test + public void providesCONSTRUCTOR_CALLS() { + assertProvides("CONSTRUCTOR_CALLS"); + } + + @Test + public void providesRemoveConditionalsMutators() { + // Note name changes from EQ_IF and ORD_IF + assertProvides("REMOVE_CONDITIONALS_EQUAL_IF"); + assertProvides("REMOVE_CONDITIONALS_EQUAL_ELSE"); + assertProvides("REMOVE_CONDITIONALS_ORDER_IF"); + assertProvides("REMOVE_CONDITIONALS_ORDER_ELSE"); + } + + @Test + public void providesRemoveConditionalsGroup() { + assertGroupHasSize("REMOVE_CONDITIONALS", 4); + } + + @Test + public void providesTRUE_RETURNS() { + assertProvides("TRUE_RETURNS"); + } + + @Test + public void providesFALSE_RETURNS() { + assertProvides("FALSE_RETURNS"); + } + + @Test + public void providesPRIMITIVE_RETURNS() { + assertProvides("PRIMITIVE_RETURNS"); + } + + @Test + public void providesEMPTY_RETURNS() { + assertProvides("EMPTY_RETURNS"); + } + + @Test + public void providesNULL_RETURNS() { + assertProvides("NULL_RETURNS"); + } + + @Test + public void providesRETURNSGroup() { + assertGroupHasSize("RETURNS",5); + } + + @Test + public void providesRemoveSwitchGroup() { + assertGroupHasSize("REMOVE_SWITCH", 100); + } + + @Test + public void providesDefaultsGroup() { + assertGroupHasSize("DEFAULTS", 11); + } + + @Test + public void providesOldDefaultsGroup() { + assertGroupHasSize("OLD_DEFAULTS", 7); + } + + @Test + public void providesStrongerGroup() { + assertGroupHasSize("STRONGER", 13); + } + + @Test + public void providesExperimentalMutators() { + assertProvides("EXPERIMENTAL_MEMBER_VARIABLE"); + assertProvides("EXPERIMENTAL_SWITCH"); + assertProvides("EXPERIMENTAL_ARGUMENT_PROPAGATION"); + assertProvides("EXPERIMENTAL_NAKED_RECEIVER"); + assertProvides("EXPERIMENTAL_BIG_INTEGER"); + } + + @Test + public void providesResearchMutators() { + assertProvides("AOR1"); + assertProvides("AOR2"); + assertProvides("AOR3"); + assertProvides("AOR4"); + + assertProvides("ABS"); + + assertProvides("AOD1"); + assertProvides("AOD2"); + + assertProvides("CRCR1"); + assertProvides("CRCR2"); + assertProvides("CRCR3"); + assertProvides("CRCR4"); + assertProvides("CRCR5"); + assertProvides("CRCR6"); + + assertProvides("OBBN1"); + assertProvides("OBBN2"); + assertProvides("OBBN3"); + + assertProvides("ROR1"); + assertProvides("ROR2"); + assertProvides("ROR3"); + assertProvides("ROR4"); + assertProvides("ROR5"); + + assertProvides("UOI1"); + assertProvides("UOI2"); + assertProvides("UOI3"); + assertProvides("UOI4"); + } + + @Test + public void providesAORGroup() { + assertGroupHasSize("AOR", 4); + } + + @Test + public void providesAODGroup() { + assertGroupHasSize("AOD", 2); + } + + @Test + public void providesCRCRGroup() { + assertGroupHasSize("CRCR", 6); + } + + @Test + public void providesOBBNGroup() { + assertGroupHasSize("OBBN", 3); + } + + @Test + public void providesRORGroup() { + assertGroupHasSize("ROR", 5); + } + + @Test + public void providesUOIGroup() { + assertGroupHasSize("UOI", 4); + } + @Test public void shouldReturnRequestedMutators() { assertThat(parseStrings("MATH", "INVERT_NEGS")).containsAll( - asList(MathMutator.MATH_MUTATOR, - InvertNegsMutator.INVERT_NEGS_MUTATOR)); + asList(MathMutator.MATH, + InvertNegsMutator.INVERT_NEGS)); } @Test @@ -48,14 +265,10 @@ public void shouldNotCreateDuplicatesWhenRequestedViaGroup() { parseStrings("DEFAULTS")); } - private Collection parseStrings(final String... s) { - return Mutator.fromStrings(asList(s)); - } - @Test - public void allContainsReplaceMethodMutator() throws Exception { + public void allContainsReplaceMethodMutator() { assertThat(Mutator.all()).contains( - ArgumentPropagationMutator.ARGUMENT_PROPAGATION_MUTATOR); + ArgumentPropagationMutator.EXPERIMENTAL_ARGUMENT_PROPAGATION); } @Test @@ -65,4 +278,29 @@ public void allMutatorIdsReturnsKeysForAllMutators() { // method is used by pitclipse assertThat(Mutator.allMutatorIds()).containsAll(incompleteSample); } + + @Test + public void allGroupContainsAllKeys() { + assertThat(parseStrings("ALL")).containsExactlyElementsOf(Mutator.all()); + } + + @Test + public void overlappingGroupsDoNotCauseDuplicates() { + assertThat(parseStrings("DEFAULTS", "DEFAULTS", "INCREMENTS", "INCREMENTS")) + .hasSameSizeAs(parseStrings("DEFAULTS", "INCREMENTS")); + } + + private Collection parseStrings(final String... s) { + return Mutator.fromStrings(asList(s)); + } + + private void assertProvides(String name) { + assertThatCode(() -> parseStrings(name)).doesNotThrowAnyException(); + } + + private void assertGroupHasSize(String name, int expected) { + assertThatCode(() -> parseStrings(name)).doesNotThrowAnyException(); + assertThat(parseStrings(name)).hasSize(expected); + } + } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutatorTest.java index 66a7e8f10..b7db7b920 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ArgumentPropagationMutatorTest.java @@ -17,7 +17,7 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; -import static org.pitest.mutationtest.engine.gregor.mutators.ArgumentPropagationMutator.ARGUMENT_PROPAGATION_MUTATOR; +import static org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator.EXPERIMENTAL_ARGUMENT_PROPAGATION; import java.util.Arrays; import java.util.Collections; @@ -33,7 +33,7 @@ public class ArgumentPropagationMutatorTest extends MutatorTestBase { @Before public void setupEngineToUseReplaceMethodWithArgumentOfSameTypeAsReturnValueMutator() { - createTesteeWith(mutateOnlyCallMethod(), ARGUMENT_PROPAGATION_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), EXPERIMENTAL_ARGUMENT_PROPAGATION); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BigIntegerMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BigIntegerMutatorTest.java index c4efbb47a..c15dd9c47 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BigIntegerMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BigIntegerMutatorTest.java @@ -32,7 +32,7 @@ public class BigIntegerMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(BigIntegerMutator.INSTANCE); + createTesteeWith(BigIntegerMutator.EXPERIMENTAL_BIG_INTEGER); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutatorTest.java index 5e8ef367c..1576d5a21 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanFalseReturnValsMutatorTest.java @@ -5,12 +5,13 @@ import org.junit.Before; import org.junit.Test; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator; public class BooleanFalseReturnValsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(BooleanFalseReturnValsMutator.BOOLEAN_FALSE_RETURN); + createTesteeWith(BooleanFalseReturnValsMutator.FALSE_RETURNS); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutatorTest.java index 9464f7b39..43eb67037 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/BooleanTrueReturnValsMutatorTest.java @@ -5,12 +5,13 @@ import org.junit.Before; import org.junit.Test; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator; public class BooleanTrueReturnValsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(BooleanTrueReturnValsMutator.BOOLEAN_TRUE_RETURN); + createTesteeWith(BooleanTrueReturnValsMutator.TRUE_RETURNS); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutatorTest.java index 8d5300464..807d2eceb 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConditionalsBoundaryMutatorTest.java @@ -27,13 +27,13 @@ public class ConditionalsBoundaryMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR); + createTesteeWith(ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY); } @Test public void shouldProvideAMeaningfulName() { - assertEquals("CONDITIONALS_BOUNDARY_MUTATOR", - ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.getName()); + assertEquals("CONDITIONALS_BOUNDARY", + ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY.getName()); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutatorTest.java index 96f96c236..48e484a22 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ConstructorCallMutatorTest.java @@ -44,7 +44,7 @@ public String call() throws Exception { @Before public void setupEngineToRemoveVoidMethods() { createTesteeWith(mutateOnlyCallMethod(), - ConstructorCallMutator.CONSTRUCTOR_CALL_MUTATOR); + ConstructorCallMutator.CONSTRUCTOR_CALLS); } @Test @@ -67,7 +67,7 @@ public void shouldNotRemoveNonVoidMethods() throws Exception { @Test public void shouldNotRemoveCallsToSuper() throws Exception { createTesteeWith(i -> true, - ConstructorCallMutator.CONSTRUCTOR_CALL_MUTATOR); + ConstructorCallMutator.CONSTRUCTOR_CALLS); assertDoesNotContain(findMutationsFor(HasConstructorCall.class), descriptionContaining("java/lang/Object::")); } @@ -95,7 +95,7 @@ public String call() throws Exception { @Test public void shouldNotRemoveCallsToDelegateContructor() throws Exception { createTesteeWith(i -> true, - ConstructorCallMutator.CONSTRUCTOR_CALL_MUTATOR); + ConstructorCallMutator.CONSTRUCTOR_CALLS); assertDoesNotContain(findMutationsFor(HasDelegateConstructorCall.class), descriptionContaining("HasDelegateConstructorCall::")); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsTest.java index 7ec693b1e..7dc073a93 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/EmptyObjectReturnValsTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.pitest.mutationtest.engine.MutationDetails; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator; import java.util.Collection; import java.util.Collections; @@ -17,7 +18,7 @@ public class EmptyObjectReturnValsTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(EmptyObjectReturnValsMutator.EMPTY_RETURN_VALUES); + createTesteeWith(EmptyObjectReturnValsMutator.EMPTY_RETURNS); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutatorTest.java index d013723fc..a651567be 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/IncrementsMutatorTest.java @@ -29,7 +29,7 @@ public class IncrementsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyIncrements() { - createTesteeWith(IncrementsMutator.INCREMENTS_MUTATOR); + createTesteeWith(IncrementsMutator.INCREMENTS); } private static class HasIncrement implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutatorTest.java index 5bc9bfe1c..32afdf3c4 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InlineConstantMutatorTest.java @@ -42,7 +42,7 @@ public Boolean call() throws Exception { @Test public void shouldProvideAMeaningfulName() { - assertEquals("INLINE_CONSTANT_MUTATOR", + assertEquals("INLINE_CONSTS", new InlineConstantMutator().getName()); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutatorTest.java index 293f25d37..c547a3f6a 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/InvertNegsMutatorTest.java @@ -30,7 +30,7 @@ public class InvertNegsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyNegs() { - createTesteeWith(InvertNegsMutator.INVERT_NEGS_MUTATOR); + createTesteeWith(InvertNegsMutator.INVERT_NEGS); } private static class NothingToMutate { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutatorTest.java index 8617b3564..b10cf0e26 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/MathMutatorTest.java @@ -25,7 +25,7 @@ public class MathMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(MathMutator.MATH_MUTATOR); + createTesteeWith(MathMutator.MATH); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutatorTest.java index 37e01af7d..588d36a12 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NegateConditionalsMutatorTest.java @@ -25,7 +25,7 @@ public class NegateConditionalsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(NegateConditionalsMutator.NEGATE_CONDITIONALS_MUTATOR); + createTesteeWith(NegateConditionalsMutator.NEGATE_CONDITIONALS); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutatorTest.java index cd1ff0cf0..18722c860 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NonVoidMethodCallMutatorTest.java @@ -36,7 +36,7 @@ public class NonVoidMethodCallMutatorTest extends MutatorTestBase { @Before public void setupEngineToRemoveVoidMethods() { createTesteeWith(mutateOnlyCallMethod(), - NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); } @Test @@ -246,7 +246,7 @@ public String call() throws Exception { @Ignore("functionality moving to filter") public void shouldNotGenerateRunErrorsWhenMutatingLoggers() throws Exception { createTesteeWith(i -> true, - NonVoidMethodCallMutator.NON_VOID_METHOD_CALL_MUTATOR); + NonVoidMethodCallMutator.NON_VOID_METHOD_CALLS); assertTrue(this.findMutationsFor(HasLogger.class).isEmpty()); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutatorTest.java index 5310d9ed0..851d3195b 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/NullReturnValsMutatorTest.java @@ -9,12 +9,13 @@ import org.junit.Test; import org.pitest.mutationtest.engine.MutationDetails; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator; public class NullReturnValsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(NullReturnValsMutator.NULL_RETURN_VALUES); + createTesteeWith(NullReturnValsMutator.NULL_RETURNS); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnMutatorTest.java index 17d5c7494..b80029785 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/PrimitiveReturnMutatorTest.java @@ -9,12 +9,13 @@ import org.junit.Test; import org.pitest.mutationtest.engine.MutationDetails; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator; public class PrimitiveReturnMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(PrimitiveReturnsMutator.PRIMITIVE_RETURN_VALS_MUTATOR); + createTesteeWith(PrimitiveReturnsMutator.PRIMITIVE_RETURNS); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorTest.java index 53a0a7244..8a0e97c3e 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/RemoveConditionalMutatorTest.java @@ -14,13 +14,13 @@ public class RemoveConditionalMutatorTest extends MutatorTestBase { @Test public void shouldProvideAMeaningfulName() { - assertEquals("REMOVE_CONDITIONALS_EQUAL_IF_MUTATOR", + assertEquals("REMOVE_CONDITIONALS_EQUAL_IF", new RemoveConditionalMutator(Choice.EQUAL, true).getName()); - assertEquals("REMOVE_CONDITIONALS_EQUAL_ELSE_MUTATOR", + assertEquals("REMOVE_CONDITIONALS_EQUAL_ELSE", new RemoveConditionalMutator(Choice.EQUAL, false).getName()); - assertEquals("REMOVE_CONDITIONALS_ORDER_IF_MUTATOR", + assertEquals("REMOVE_CONDITIONALS_ORDER_IF", new RemoveConditionalMutator(Choice.ORDER, true).getName()); - assertEquals("REMOVE_CONDITIONALS_ORDER_ELSE_MUTATOR", + assertEquals("REMOVE_CONDITIONALS_ORDER_ELSE", new RemoveConditionalMutator(Choice.ORDER, false).getName()); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutatorTest.java index 1bea64a28..56999339c 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/ReturnValsMutatorTest.java @@ -27,7 +27,7 @@ public class ReturnValsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyReturnVals() { - createTesteeWith(ReturnValsMutator.RETURN_VALS_MUTATOR); + createTesteeWith(ReturnValsMutator.RETURN_VALS); } private static class IReturn implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutatorTest.java index 173da2c4c..60e7eebe0 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/VoidMethodCallMutatorTest.java @@ -31,7 +31,7 @@ public class VoidMethodCallMutatorTest extends MutatorTestBase { @Before public void setupEngineToRemoveVoidMethods() { createTesteeWith(mutateOnlyCallMethod(), - VoidMethodCallMutator.VOID_METHOD_CALL_MUTATOR); + VoidMethodCallMutator.VOID_METHOD_CALLS); } static class HasVoidMethodCall implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutatorTest.java index 2d3322ac3..2fad6d252 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/MemberVariableMutatorTest.java @@ -41,7 +41,7 @@ public void setupEngineToMutateOnlyMemberVariables() { @Test public void shouldProvideAMeaningfulName() { - assertEquals("EXPERIMENTAL_MEMBER_VARIABLE_MUTATOR", + assertEquals("EXPERIMENTAL_MEMBER_VARIABLE", new MemberVariableMutator().getName()); } diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutatorTest.java index d04192c08..3bbe2c126 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/NakedReceiverMutatorTest.java @@ -16,7 +16,7 @@ package org.pitest.mutationtest.engine.gregor.mutators.experimental; import static java.util.Collections.singletonList; -import static org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator.NAKED_RECEIVER; +import static org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator.EXPERIMENTAL_NAKED_RECEIVER; import java.util.ArrayList; import java.util.concurrent.Callable; @@ -30,7 +30,7 @@ public class NakedReceiverMutatorTest extends MutatorTestBase { @Before public void setupEngineToUseReplaceMethodWithArgumentOfSameTypeAsReturnValueMutator() { - createTesteeWith(mutateOnlyCallMethod(), NAKED_RECEIVER); + createTesteeWith(mutateOnlyCallMethod(), EXPERIMENTAL_NAKED_RECEIVER); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutatorTest.java index 212f7ca6e..cb6d7efde 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/RemoveIncrementsMutatorTest.java @@ -30,7 +30,7 @@ public class RemoveIncrementsMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyIncrements() { - createTesteeWith(RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR); + createTesteeWith(RemoveIncrementsMutator.REMOVE_INCREMENTS); } private static class HasIncrement implements Callable { @@ -47,8 +47,8 @@ public String call() throws Exception { @Test public void shouldProvideAMeaningfulName() { - assertEquals("REMOVE_INCREMENTS_MUTATOR", - RemoveIncrementsMutator.REMOVE_INCREMENTS_MUTATOR.getName()); + assertEquals("REMOVE_INCREMENTS", + RemoveIncrementsMutator.REMOVE_INCREMENTS.getName()); } @Test diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutatorTest.java index e577a07b0..c096723cb 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/experimental/SwitchMutatorTest.java @@ -33,7 +33,7 @@ public void setupEngineToMutateOnlySwitchStatements() { @Test public void shouldProvideAMeaningfulName() { - assertEquals("EXPERIMENTAL_SWITCH_MUTATOR", new SwitchMutator().getName()); + assertEquals("EXPERIMENTAL_SWITCH", new SwitchMutator().getName()); } private static class HasIntSwitchWithDefault implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutatorTest.java index 7ed9e4644..337e21833 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ABSMutatorTest.java @@ -20,13 +20,12 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ABSMutator; public class ABSMutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(mutateOnlyCallMethod(), ABSMutator.ABS_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), ABSMutator.ABS); } private static class HasILoad implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1MutatorTest.java index a04f23bf3..57094a460 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD1MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD1Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOD1MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOD1Mutator.AOD_1_MUTATOR); + createTesteeWith(AOD1Mutator.AOD1); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2MutatorTest.java index 2ddec0658..61300d0f3 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOD2MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOD2Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOD2MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOD2Mutator.AOD_2_MUTATOR); + createTesteeWith(AOD2Mutator.AOD2); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1MutatorTest.java index 13dceff56..e16b7a894 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR1MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR1Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOR1MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOR1Mutator.AOR_1_MUTATOR); + createTesteeWith(AOR1Mutator.AOR1); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2MutatorTest.java index 73ddf0579..d80087544 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR2MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR2Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOR2MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOR2Mutator.AOR_2_MUTATOR); + createTesteeWith(AOR2Mutator.AOR2); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3MutatorTest.java index cc7bd6aea..7c3414375 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR3MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR3Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOR3MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOR3Mutator.AOR_3_MUTATOR); + createTesteeWith(AOR3Mutator.AOR3); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4MutatorTest.java index dd639e629..02abace33 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/AOR4MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.AOR4Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class AOR4MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(AOR4Mutator.AOR_4_MUTATOR); + createTesteeWith(AOR4Mutator.AOR4); } private static class HasIAdd implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Test.java index b7f25f0ac..14de1489d 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR1Test.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR1Mutator; import java.util.concurrent.Callable; @@ -27,7 +26,7 @@ public class CRCR1Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR1Mutator.CRCR_1_MUTATOR); + createTesteeWith(CRCR1Mutator.CRCR1); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Test.java index c611f1930..cb1100091 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR2Test.java @@ -21,13 +21,12 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR2Mutator; public class CRCR2Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR2Mutator.CRCR_2_MUTATOR); + createTesteeWith(CRCR2Mutator.CRCR2); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Test.java index 8b35bf8cd..888a4bb8c 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR3Test.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR3Mutator; import java.util.concurrent.Callable; @@ -27,7 +26,7 @@ public class CRCR3Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR3Mutator.CRCR_3_MUTATOR); + createTesteeWith(CRCR3Mutator.CRCR3); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Test.java index fdde04607..38d4dc2c4 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR4Test.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR4Mutator; import java.util.concurrent.Callable; @@ -27,7 +26,7 @@ public class CRCR4Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR4Mutator.CRCR_4_MUTATOR); + createTesteeWith(CRCR4Mutator.CRCR4); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Test.java index e0eaa3b25..7f41d16f4 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR5Test.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR5Mutator; import java.util.concurrent.Callable; @@ -27,7 +26,7 @@ public class CRCR5Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR5Mutator.CRCR_5_MUTATOR); + createTesteeWith(CRCR5Mutator.CRCR5); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Test.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Test.java index 49f7a8a89..86b03c8c4 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Test.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/CRCR6Test.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.CRCR6Mutator; import java.util.concurrent.Callable; @@ -27,7 +26,7 @@ public class CRCR6Test extends MutatorTestBase { @Before public void setupEngineToMutateOnlyInlineConstants() { - createTesteeWith(CRCR6Mutator.CRCR_6_MUTATOR); + createTesteeWith(CRCR6Mutator.CRCR6); } private static class HasIntegerICONST0 implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1MutatorTest.java index 9c7177aba..25eef53f6 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN1MutatorTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN1Mutator; import java.util.concurrent.Callable; @@ -12,7 +11,7 @@ public class OBBN1MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(OBBN1Mutator.OBBN_1_MUTATOR); + createTesteeWith(OBBN1Mutator.OBBN1); } private static class HasIOr implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2MutatorTest.java index ed2ef2c83..bee8050f6 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN2MutatorTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN2Mutator; import java.util.concurrent.Callable; @@ -12,7 +11,7 @@ public class OBBN2MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(OBBN2Mutator.OBBN_2_MUTATOR); + createTesteeWith(OBBN2Mutator.OBBN2); } private static class HasIOr implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3MutatorTest.java index fc139f9a1..400383747 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/OBBN3MutatorTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.OBBN3Mutator; import java.util.concurrent.Callable; @@ -12,7 +11,7 @@ public class OBBN3MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(OBBN3Mutator.OBBN_3_MUTATOR); + createTesteeWith(OBBN3Mutator.OBBN3); } private static class HasIOr implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1MutatorTest.java index 38935ae80..3a575a169 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR1MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR1Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class ROR1MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ROR1Mutator.ROR_1_MUTATOR); + createTesteeWith(ROR1Mutator.ROR1); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2MutatorTest.java index 01e1b7be9..f171900e1 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR2MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR2Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class ROR2MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ROR2Mutator.ROR_2_MUTATOR); + createTesteeWith(ROR2Mutator.ROR2); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3MutatorTest.java index 84134e007..4d98c15af 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR3MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR3Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class ROR3MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ROR3Mutator.ROR_3_MUTATOR); + createTesteeWith(ROR3Mutator.ROR3); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4MutatorTest.java index 0ffe12968..23afe1c43 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR4MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR4Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class ROR4MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ROR4Mutator.ROR_4_MUTATOR); + createTesteeWith(ROR4Mutator.ROR4); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5MutatorTest.java index 3aeae928a..3c5390c11 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/ROR5MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.ROR5Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class ROR5MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyConditionals() { - createTesteeWith(ROR5Mutator.ROR_5_MUTATOR); + createTesteeWith(ROR5Mutator.ROR5); } private static int getZeroButPreventInlining() { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1MutatorTest.java index 1d61060da..021f65578 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI1MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI1Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class UOI1MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(mutateOnlyCallMethod(), UOI1Mutator.UOI_1_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), UOI1Mutator.UOI1); } private static class HasILoad implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2MutatorTest.java index c0cbd28f6..f17134a08 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI2MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI2Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class UOI2MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(mutateOnlyCallMethod(), UOI2Mutator.UOI_2_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), UOI2Mutator.UOI2); } private static class HasILoad implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3MutatorTest.java index 07a44a52f..a4159ce5d 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI3MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI3Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class UOI3MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(mutateOnlyCallMethod(), UOI3Mutator.UOI_3_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), UOI3Mutator.UOI3); } private static class HasILoad implements Callable { diff --git a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4MutatorTest.java b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4MutatorTest.java index 18f59dbb4..5d89b653d 100644 --- a/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4MutatorTest.java +++ b/pitest/src/test/java/org/pitest/mutationtest/engine/gregor/mutators/rv/UOI4MutatorTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.gregor.MutatorTestBase; -import org.pitest.mutationtest.engine.gregor.mutators.rv.UOI4Mutator; import java.util.concurrent.Callable; @@ -26,7 +25,7 @@ public class UOI4MutatorTest extends MutatorTestBase { @Before public void setupEngineToMutateOnlyMathFunctions() { - createTesteeWith(mutateOnlyCallMethod(), UOI4Mutator.UOI_4_MUTATOR); + createTesteeWith(mutateOnlyCallMethod(), UOI4Mutator.UOI4); } private static class HasILoad implements Callable {