diff --git a/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java b/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java index b87a6278..978639dd 100644 --- a/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java +++ b/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java @@ -28,7 +28,6 @@ */ public enum Mutators { CUSTOM("Custom mutator data", "This is used for the custom settings of mutators and should not be seen by the user."), - OLD_DEFAULTS("Old defaults", "&Old default Mutators"), DEFAULTS("Defaults", "&Default Mutators"), STRONGER("Stronger defaults", "&Stronger Mutators"), ALL("All", "&All Mutators"), @@ -49,48 +48,18 @@ public enum Mutators { NON_VOID_METHOD_CALLS("Non Void Method Call", "Removes method calls to non void methods. Their return value is replaced by the Java Default Value for that specific type"), PRIMITIVE_RETURNS("Primite Returns", "Replaces int, short, long, char, float and double return values with 0", true), REMOVE_CONDITIONALS("Remove Conditionals", "Removes all conditionals statements such that the guarded statements always execute"), - REMOVE_CONDITIONALS_EQ_IF("Remove Equal Conditionals If", "Remove equal conditions and replace with true, execute if part"), - REMOVE_CONDITIONALS_EQ_ELSE("Remove Equal Conditionals Else", "Remove equal conditions and replace with false, execute else part"), - REMOVE_CONDITIONALS_ORD_IF("Remove Order Checks If", "Remove order conditions and replace with true, execute if part"), - REMOVE_CONDITIONALS_ORD_ELSE("Remove Order Checks Else", "Remove order conditions and replace with false, execute else part"), + REMOVE_CONDITIONALS_EQUAL_IF("Remove Equal Conditionals If", "Remove equal conditions and replace with true, execute if part"), + REMOVE_CONDITIONALS_EQUAL_ELSE("Remove Equal Conditionals Else", "Remove equal conditions and replace with false, execute else part"), + REMOVE_CONDITIONALS_ORDER_IF("Remove Order Checks If", "Remove order conditions and replace with true, execute if part"), + REMOVE_CONDITIONALS_ORDER_ELSE("Remove Order Checks Else", "Remove order conditions and replace with false, execute else part"), REMOVE_INCREMENTS("Remove Increments", "Removes local variable increments"), EXPERIMENTAL_ARGUMENT_PROPAGATION("Experimentation Argument Propagation", "Replaces method call with one of its parameters of matching type"), EXPERIMENTAL_BIG_INTEGER("Experimental Big Integer", "Swaps big integer methods"), + EXPERIMENTAL_BIG_DECIMAL("Experimental Big Decimal", "Swaps big decimal methods"), EXPERIMENTAL_NAKED_RECEIVER("Experimental Naked Receiver", "Replaces method call with a naked receiver"), EXPERIMENTAL_MEMBER_VARIABLE("Experimental Member Variable", "Removes assignments to member variables. Can even remove assignments to final members. The members will be initialized with their Java Default Value"), EXPERIMENTAL_SWITCH("Experimental Switch", "Finds the first label within a switch statement that differs from the default label. Mutates the switch statement by replacing the default label (wherever it is used) with this label. All the other labels are replaced by the default one"), - ABS("Negation", "Replaces any use of a numeric variable (local variable, field, array cell) with its negation"), - AOR("Arithmetic Operator Replacement", "Like the Math mutator, replaces binary arithmetic operations for either integer or floating-point arithmetic with another operation"), - AOR_1("Arithmetic Operator Replacement 1", "+ -> -, - -> +, * -> /, / -> *, % -> *"), - AOR_2("Arithmetic Operator Replacement 2", "+ -> *, - -> *, * -> %, / -> %, % -> /"), - AOR_3("Arithmetic Operator Replacement 3", "+ -> /, - -> /, * -> +, / -> +, % -> +"), - AOR_4("Arithmetic Operator Replacement 4", "+ -> %, - -> %, * -> -, / -> -, % -> -"), - AOD("Arithmetic Operator Deletion", "Replaces an arithmetic operation with one of its members"), - AOD1("Arithmetic Operator Deletion 1", "int a = b + c; -> int a = b;"), - AOD2("Arithmetic Operator Deletion 2", "int a = b + c; -> int a = c;"), - CRCR("Constant Replacement", "Like the Inline Constant mutator, mutates inline constant"), - CRCR1("Constant Replacement 1", "Replaces the inline constant c with 1"), - CRCR2("Constant Replacement 2", "Replaces the inline constant c with 0"), - CRCR3("Constant Replacement 3", "Replaces the inline constant c with -1"), - CRCR4("Constant Replacement 4", "Replaces the inline constant c with -c"), - CRCR5("Constant Replacement 5", "Replaces the inline constant c with c+1"), - CRCR6("Constant Replacement 6", "Replaces the inline constant c with c-1"), - OBBN("Bitwise Operator", "Mutates bitwise and (&) and or (|)"), - OBBN1("Bitwise Operator 1", "a & b; -> a | b;"), - OBBN2("Bitwise Operator 2", "a & b; -> a;"), - OBBN3("Bitwise Operator 3", "a & b; -> b;"), - ROR("Relational Operator Replacement", "Replaces a relational operator with another one"), - ROR1("Relational Operator Replacement 1", "< -> <=, <= -> <, > -> <, >= -> <, == -> <, != -> <"), - ROR2("Relational Operator Replacement 2", "< -> >, <= -> >, > -> <=, >= -> <=, == -> <=, != -> <="), - ROR3("Relational Operator Replacement 3", "< -> >=, <= -> >=, > -> >=, >= -> >, == -> >, != -> >"), - ROR4("Relational Operator Replacement 4", "< -> ==, <= -> ==, > -> ==, >= -> ==, == -> >=, != -> >="), - ROR5("Relational Operator Replacement 5", "< -> !=, <= -> !=, > -> !=, >= -> !=, == -> !=, != -> =="), - // XXX REMOVE_SWITCH("",""), no data on the page of pitest - UOI1("Unary Operator Insertion 1", "Inserts a unary operator to a variable call from the variable a to a++"), - UOI2("Unary Operator Insertion 2", "Inserts a unary operator to a variable call from the variable a to a--"), - UOI3("Unary Operator Insertion 3", "Inserts a unary operator to a variable call from the variable a to ++a"), - UOI4("Unary Operator Insertion 4", "Inserts a unary operator to a variable call from the variable a to --a"), - UOI("Unary Operator Insertion", "Inserts a unary operator (increment or decrement) to a variable call. Affects local variables, array variables, fields and parameters"); + REMOVE_SWITCH("Remove Switch", "Finds the first switch label that differs from the default label, then replaces the default label with this label, and all other labels are replaced with the default one"); /** * Descriptor which is used to display the name of this mutator in a table @@ -132,7 +101,6 @@ public static List getMainGroup() { mainGroup.add(DEFAULTS); mainGroup.add(STRONGER); mainGroup.add(ALL); - mainGroup.add(OLD_DEFAULTS); return mainGroup; } diff --git a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/mutations/PitclipseMutationsResultListener.java b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/mutations/PitclipseMutationsResultListener.java index 0da4235a..1e2ab315 100644 --- a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/mutations/PitclipseMutationsResultListener.java +++ b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/mutations/PitclipseMutationsResultListener.java @@ -61,7 +61,7 @@ public void handleMutationResult(ClassMutationResults results) { result.getKillingTest().ifPresent(mutation::setKillingTest); mutation.setLineNumber(BigInteger.valueOf(details.getLineNumber())); mutation.setMutatedClass(details.getClassName().asJavaName()); - mutation.setMutatedMethod(details.getMethod().name()); + mutation.setMutatedMethod(details.getMethod()); mutation.setMutator(details.getMutator()); mutation.setSourceFile(details.getFilename()); mutation.setStatus(DetectionStatusCoverter.convert(result.getStatus())); diff --git a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java index fb5084de..599ac16f 100644 --- a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java +++ b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java @@ -20,7 +20,6 @@ import java.util.Collection; import java.util.Objects; -import org.pitest.classinfo.ClassInfo; import org.pitest.mutationtest.ClassMutationResults; import org.pitest.mutationtest.MutationResult; @@ -43,13 +42,13 @@ private ClassSummary(String className, Coverage lineCoverage, Coverage mutationC this.mutationCoverage = mutationCoverage; } - public static ClassSummary from(ClassMutationResults results, ClassInfo classInfo, int linesCovered) { + public static ClassSummary from(ClassMutationResults results, int numberOfCodeLines, int linesCovered) { Collection mutations = results.getMutations(); int totalMutations = mutations.size(); int survivedMutations = (int) mutations.stream() .filter(m -> !m.getStatus().isDetected()) .count(); - Coverage lineCoverage = Coverage.from(linesCovered, classInfo.getNumberOfCodeLines()); + Coverage lineCoverage = Coverage.from(linesCovered, numberOfCodeLines); Coverage mutationCoverage = Coverage.from(totalMutations - survivedMutations, totalMutations); return from(results.getMutatedClass().asJavaName(), lineCoverage, mutationCoverage); diff --git a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java index 4427c67b..f6d41e28 100644 --- a/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java +++ b/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java @@ -19,9 +19,8 @@ import java.util.Collections; import java.util.List; -import org.pitest.classinfo.ClassInfo; import org.pitest.classinfo.ClassName; -import org.pitest.coverage.CoverageDatabase; +import org.pitest.coverage.ReportCoverage; import org.pitest.mutationtest.ClassMutationResults; import org.pitest.mutationtest.MutationResultListener; import org.pitest.pitclipse.runner.results.Dispatcher; @@ -37,7 +36,7 @@ public class SummaryResultListener implements MutationResultListener { private SummaryResult result = SummaryResult.EMPTY; private final Dispatcher dispatcher; - private final CoverageDatabase coverage; + private final ReportCoverage coverage; /** * Creates a new listener that will compute a summary of the whole PIT analysis. @@ -47,7 +46,7 @@ public class SummaryResultListener implements MutationResultListener { * @param coverage * The coverage computed from the tests. */ - public SummaryResultListener(Dispatcher dispatcher, CoverageDatabase coverage) { + public SummaryResultListener(Dispatcher dispatcher, ReportCoverage coverage) { this.dispatcher = dispatcher; this.coverage = coverage; } @@ -59,12 +58,14 @@ public void runStart() { @Override public void handleMutationResult(ClassMutationResults results) { - List classUnderTest = Collections.singletonList(results.getMutatedClass()); - int coveredLines = coverage.getNumberOfCoveredLines(classUnderTest); - for (ClassInfo info : coverage.getClassInfo(classUnderTest)) { - ClassSummary classSummary = ClassSummary.from(results, info, coveredLines); - result = result.update(classSummary); - } + List classesUnderTest = Collections.singletonList(results.getMutatedClass()); + + for (ClassName classUnderTest : classesUnderTest) { + int numberOfCoveredLines = coverage.getCoveredLines(classUnderTest).size(); + int numberOfLines = coverage.getCodeLinesForClass(classUnderTest).getNumberOfCodeLines(); + ClassSummary classSummary = ClassSummary.from(results, numberOfLines, numberOfCoveredLines); + result = result.update(classSummary); + } } @Override diff --git a/bundles/org.pitest.pitest-junit5-plugin/META-INF/MANIFEST.MF b/bundles/org.pitest.pitest-junit5-plugin/META-INF/MANIFEST.MF index 043895a0..43e93b14 100644 --- a/bundles/org.pitest.pitest-junit5-plugin/META-INF/MANIFEST.MF +++ b/bundles/org.pitest.pitest-junit5-plugin/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: pitest-junit5-plugin Bundle-SymbolicName: org.pitest.pitest-junit5-plugin -Bundle-Version: 0.14.0.qualifier +Bundle-Version: 1.2.1.qualifier Bundle-ClassPath: lib/pitest-junit5-plugin-sources.jar, lib/pitest-junit5-plugin-javadoc.jar, lib/pitest-junit5-plugin.jar, diff --git a/bundles/org.pitest.pitest-junit5-plugin/pom.xml b/bundles/org.pitest.pitest-junit5-plugin/pom.xml index 61ff96ca..854a3929 100644 --- a/bundles/org.pitest.pitest-junit5-plugin/pom.xml +++ b/bundles/org.pitest.pitest-junit5-plugin/pom.xml @@ -9,7 +9,7 @@ org.pitest.pitest-junit5-plugin - 0.14.0-SNAPSHOT + 1.2.1-SNAPSHOT eclipse-plugin Wraps Pitest JUnit 5 Plugin's JAR as an Eclipse plug-in @@ -17,7 +17,7 @@ - 0.14 + 1.2.1 diff --git a/bundles/org.pitest/META-INF/MANIFEST.MF b/bundles/org.pitest/META-INF/MANIFEST.MF index 5ffd0506..84c567bd 100644 --- a/bundles/org.pitest/META-INF/MANIFEST.MF +++ b/bundles/org.pitest/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Pitest Bundle-SymbolicName: org.pitest -Bundle-Version: 1.6.8.qualifier +Bundle-Version: 1.15.8.qualifier Bundle-ClassPath: lib/pitest-command-line-javadoc.jar, lib/pitest-command-line-sources.jar, lib/pitest-command-line.jar, @@ -34,7 +34,6 @@ Export-Package: joptsimple, org.pitest.coverage.analysis, org.pitest.coverage.execute, org.pitest.coverage.export, - org.pitest.dependency, org.pitest.extension.common, org.pitest.functional, org.pitest.functional.predicate, @@ -60,7 +59,6 @@ Export-Package: joptsimple, org.pitest.mutationtest.engine.gregor.config, org.pitest.mutationtest.engine.gregor.mutators, org.pitest.mutationtest.engine.gregor.mutators.experimental, - org.pitest.mutationtest.engine.gregor.mutators.rv, org.pitest.mutationtest.execute, org.pitest.mutationtest.filter, org.pitest.mutationtest.incremental, @@ -98,7 +96,6 @@ Export-Package: joptsimple, org.pitest.testapi, org.pitest.testapi.execute, org.pitest.testapi.execute.containers, - org.pitest.testng, org.pitest.util, sun.pitest Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/bundles/org.pitest/pom.xml b/bundles/org.pitest/pom.xml index d50966c1..84d08e98 100644 --- a/bundles/org.pitest/pom.xml +++ b/bundles/org.pitest/pom.xml @@ -9,12 +9,12 @@ org.pitest - 1.6.8-SNAPSHOT + 1.15.8-SNAPSHOT eclipse-plugin Wraps Pitest JAR as an Eclipse plug-in - 1.6.8 + 1.15.8 diff --git a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/MutatorApiOfPitTest.java b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/MutatorApiOfPitTest.java index 10c1426f..56ddf905 100644 --- a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/MutatorApiOfPitTest.java +++ b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/MutatorApiOfPitTest.java @@ -41,68 +41,35 @@ private String getPitMutatorsAsString() { } private String getExpectedMutatorsAsString() { - return "INVERT_NEGS\n" - + "RETURN_VALS\n" - + "INLINE_CONSTS\n" - + "MATH\n" - + "VOID_METHOD_CALLS\n" - + "NEGATE_CONDITIONALS\n" - + "CONDITIONALS_BOUNDARY\n" - + "INCREMENTS\n" - + "REMOVE_INCREMENTS\n" - + "NON_VOID_METHOD_CALLS\n" - + "CONSTRUCTOR_CALLS\n" - + "REMOVE_CONDITIONALS_EQ_IF\n" - + "REMOVE_CONDITIONALS_EQ_ELSE\n" - + "REMOVE_CONDITIONALS_ORD_IF\n" - + "REMOVE_CONDITIONALS_ORD_ELSE\n" - + "REMOVE_CONDITIONALS\n" - + "TRUE_RETURNS\n" - + "FALSE_RETURNS\n" - + "PRIMITIVE_RETURNS\n" - + "EMPTY_RETURNS\n" - + "NULL_RETURNS\n" - + "RETURNS\n" - + "EXPERIMENTAL_MEMBER_VARIABLE\n" - + "EXPERIMENTAL_SWITCH\n" - + "EXPERIMENTAL_ARGUMENT_PROPAGATION\n" - + "EXPERIMENTAL_NAKED_RECEIVER\n" - + "EXPERIMENTAL_BIG_INTEGER\n" - + "AOR_1\n" - + "AOR_2\n" - + "AOR_3\n" - + "AOR_4\n" - + "ABS\n" - + "AOD1\n" - + "AOD2\n" - + "CRCR1\n" - + "CRCR2\n" - + "CRCR3\n" - + "CRCR4\n" - + "CRCR5\n" - + "CRCR6\n" - + "OBBN1\n" - + "OBBN2\n" - + "OBBN3\n" - + "ROR1\n" - + "ROR2\n" - + "ROR3\n" - + "ROR4\n" - + "ROR5\n" - + "UOI1\n" - + "UOI2\n" - + "UOI3\n" - + "UOI4\n" - + "REMOVE_SWITCH\n" - + "OLD_DEFAULTS\n" - + "STRONGER\n" - + "ALL\n" - + "DEFAULTS\n" - + "AOR\n" - + "AOD\n" - + "CRCR\n" - + "OBBN\n" - + "ROR\n" - + "UOI\n"; + return "REMOVE_CONDITIONALS_ORDER_IF\n" + + "REMOVE_CONDITIONALS\n" + + "REMOVE_CONDITIONALS_EQUAL_IF\n" + + "TRUE_RETURNS\n" + + "REMOVE_CONDITIONALS_EQUAL_ELSE\n" + + "VOID_METHOD_CALLS\n" + + "PRIMITIVE_RETURNS\n" + + "FALSE_RETURNS\n" + + "NON_VOID_METHOD_CALLS\n" + + "INVERT_NEGS\n" + + "CONDITIONALS_BOUNDARY\n" + + "REMOVE_CONDITIONALS_ORDER_ELSE\n" + + "DEFAULTS\n" + + "EXPERIMENTAL_SWITCH\n" + + "RETURNS\n" + + "EXPERIMENTAL_MEMBER_VARIABLE\n" + + "NULL_RETURNS\n" + + "EXPERIMENTAL_BIG_DECIMAL\n" + + "MATH\n" + + "EXPERIMENTAL_BIG_INTEGER\n" + + "INCREMENTS\n" + + "EXPERIMENTAL_ARGUMENT_PROPAGATION\n" + + "EXPERIMENTAL_NAKED_RECEIVER\n" + + "CONSTRUCTOR_CALLS\n" + + "REMOVE_SWITCH\n" + + "INLINE_CONSTS\n" + + "STRONGER\n" + + "REMOVE_INCREMENTS\n" + + "NEGATE_CONDITIONALS\n" + + "EMPTY_RETURNS\n"; } } diff --git a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/mutations/ListenerTestFixture.java b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/mutations/ListenerTestFixture.java index 69e500ad..33f8d43b 100644 --- a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/mutations/ListenerTestFixture.java +++ b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/mutations/ListenerTestFixture.java @@ -28,7 +28,6 @@ import org.pitest.mutationtest.MutationResult; import org.pitest.mutationtest.MutationStatusTestPair; import org.pitest.mutationtest.engine.Location; -import org.pitest.mutationtest.engine.MethodName; import org.pitest.mutationtest.engine.MutationDetails; import org.pitest.mutationtest.engine.MutationIdentifier; import org.pitest.pitclipse.example.Foo; @@ -48,7 +47,7 @@ class ListenerTestFixture { private static final ObjectFactory JAXB_OBJECT_FACTORY = new ObjectFactory(); public static ClassMutationResults aClassMutationResult() { - Location location = new Location(ClassName.fromClass(Foo.class), MethodName.fromString("doFoo"), "doFoo"); + Location location = new Location(ClassName.fromClass(Foo.class), "doFoo", "doFoo"); MutationIdentifier id = new MutationIdentifier(location, 1, "SomeMutator"); MutationDetails md = new MutationDetails(id, "org/pitest/pitclipse/example/Foo.java", TEST_FACTORY.aString(), 20, TEST_FACTORY.aRandomInt()); diff --git a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListenerTestData.java b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListenerTestData.java index 03e14e8c..63c9e9be 100644 --- a/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListenerTestData.java +++ b/tests/org.pitest.pitclipse.runner.tests/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListenerTestData.java @@ -16,39 +16,35 @@ package org.pitest.pitclipse.runner.results.summary; -import static com.google.common.base.Predicates.notNull; -import static com.google.common.collect.Collections2.filter; -import static com.google.common.collect.Collections2.transform; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import static java.util.stream.Collectors.toSet; import static org.pitest.mutationtest.DetectionStatus.KILLED; import static org.pitest.mutationtest.DetectionStatus.NO_COVERAGE; import static org.pitest.pitclipse.runner.TestFactory.TEST_FACTORY; import java.math.BigInteger; import java.util.Collection; -import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; +import java.util.stream.IntStream; +import java.util.stream.Stream; -import org.pitest.classinfo.ClassInfo; import org.pitest.classinfo.ClassName; +import org.pitest.coverage.BlockLocation; import org.pitest.coverage.ClassLine; +import org.pitest.coverage.ClassLines; import org.pitest.coverage.CoverageDatabase; -import org.pitest.coverage.CoverageSummary; -import org.pitest.coverage.InstructionLocation; import org.pitest.coverage.TestInfo; import org.pitest.mutationtest.ClassMutationResults; import org.pitest.mutationtest.DetectionStatus; import org.pitest.mutationtest.MutationResult; import org.pitest.mutationtest.MutationStatusTestPair; import org.pitest.mutationtest.engine.Location; -import org.pitest.mutationtest.engine.MethodName; import org.pitest.mutationtest.engine.MutationDetails; import org.pitest.mutationtest.engine.MutationIdentifier; import org.pitest.pitclipse.example.Foo; import org.pitest.pitclipse.runner.results.summary.SummaryResultListenerTestSugar.SummaryResultWrapper; -import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -78,7 +74,7 @@ public static CoverageDatabase fooHasFullLineCoverage() { } private static ClassMutationResults aClassMutationResultForFooWithStatus(DetectionStatus detectionStatus) { - Location location = new Location(ClassName.fromClass(Foo.class), MethodName.fromString("doFoo"), "doFoo"); + Location location = new Location(ClassName.fromClass(Foo.class), "doFoo", "doFoo"); MutationIdentifier id = new MutationIdentifier(location, 1, "SomeMutator"); MutationDetails md = new MutationDetails(id, "org/pitest/pitclipse/example/Foo.java", TEST_FACTORY.aString(), 9, TEST_FACTORY.aRandomInt()); @@ -90,36 +86,31 @@ private static ClassMutationResults aClassMutationResultForFooWithStatus(Detecti private static class CoverageTestData { - public static final CoverageTestData FOO_WITH_FULL_COVERAGE = new CoverageTestData(Foo.class, fooInfo(1), 1); - public static final CoverageTestData FOO_WITH_NO_COVERAGE = new CoverageTestData(Foo.class, fooInfo(1), 0); + public static final CoverageTestData FOO_WITH_FULL_COVERAGE = new CoverageTestData(Foo.class, 1, 1); + public static final CoverageTestData FOO_WITH_NO_COVERAGE = new CoverageTestData(Foo.class, 1, 0); public final ClassName className; - public final ClassInfo classInfo; public final int linesCovered; + public final int totalNumberOfLines; public final StubbedCoverage coverageDatabase; - private CoverageTestData(Class clazz, ClassInfo classInfo, int linesCovered) { + private CoverageTestData(Class clazz, int totalNumberOfLines, int linesCovered) { this.className = ClassName.fromClass(clazz); - this.classInfo = classInfo; this.linesCovered = linesCovered; + this.totalNumberOfLines = totalNumberOfLines; this.coverageDatabase = new StubbedCoverage(this); } - private static ClassInfo fooInfo(int totalLines) { - ClassInfo info = mock(ClassInfo.class); - when(info.getNumberOfCodeLines()).thenReturn(totalLines); - return info; - } } private static class StubbedCoverage implements CoverageDatabase { // DATABASE; - private final Map classInfo; + private final Map classInfo; private final Map classCoverage; private StubbedCoverage(CoverageTestData coverageTestData) { - classInfo = ImmutableMap.of(coverageTestData.className, coverageTestData.classInfo); + classInfo = ImmutableMap.of(coverageTestData.className, coverageTestData.totalNumberOfLines); classCoverage = ImmutableMap.of(coverageTestData.className, coverageTestData.linesCovered); } @@ -128,61 +119,43 @@ private StubbedCoverage() { classCoverage = ImmutableMap.of(); } - @Override - public Collection getClassInfo(Collection classes) { - return filter(transform(classes, classInfoLookup()), notNull()); - } - - @Override - public int getNumberOfCoveredLines(Collection classes) { - int total = 0; - for (ClassName className : classes) { - total += coverageFor(className); - } - return total; - } - - private int coverageFor(ClassName className) { - return classCoverage.getOrDefault(className, 0); - } + @Override + public ClassLines getCodeLinesForClass(ClassName clazz) { + int totalNumberOfLines = classInfo.getOrDefault(clazz, -1); + Set linesNumber = Stream.iterate(1, x -> x + 1).limit(totalNumberOfLines).collect(toSet()); + return new ClassLines(clazz, linesNumber); + } + + @Override + public Set getCoveredLines(ClassName clazz) { + int expectedNbOfLinesCovered = classCoverage.getOrDefault(clazz, -1); + + Set lines = new HashSet<>(); + for (int i = 0; i < expectedNbOfLinesCovered; ++i) { + lines.add(new ClassLine(clazz, i)); + } + return lines; + } + + @Override + public Collection getTestsForBlockLocation(BlockLocation location) { + throw new UnsupportedOperationException("the stub does not implement getTestsForBlockLocation"); + } @Override public Collection getTestsForClass(ClassName clazz) { return ImmutableList.of(); } - @Override - public Collection getTestsForClassLine(ClassLine classLine) { - return ImmutableList.of(); - } - @Override public BigInteger getCoverageIdForClass(ClassName clazz) { return TEST_FACTORY.aRandomBigInteger(); } @Override - public Collection getClassesForFile(String sourceFile, String packageName) { + public Collection getClassesForFile(String sourceFile, String packageName) { return ImmutableList.of(); } - @Override - public CoverageSummary createSummary() { - return null; - } - - private Function classInfoLookup() { - return new Function() { - @Override - public ClassInfo apply(ClassName input) { - return classInfo.get(input); - } - }; - } - - @Override - public Collection getTestsForInstructionLocation(InstructionLocation location) { - return Collections.emptyList(); - } } } diff --git a/tests/org.pitest.pitclipse.ui.tests/old-cucumber/j06_mutations_view.feature b/tests/org.pitest.pitclipse.ui.tests/old-cucumber/j06_mutations_view.feature index 5a248edd..e81b8cd1 100644 --- a/tests/org.pitest.pitclipse.ui.tests/old-cucumber/j06_mutations_view.feature +++ b/tests/org.pitest.pitclipse.ui.tests/old-cucumber/j06_mutations_view.feature @@ -13,8 +13,8 @@ Feature: Mutation view shows analysis results Then a coverage report is generated with 2 classes tested with overall coverage of 80% and mutation coverage of 0% And the mutation results are | status | project | package | class | line | mutation | - | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional | - | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional | + | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false | + | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false | | NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | Replaced integer addition with subtraction | | NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | replaced int return with 0 for foo/bar/Bar::f | | NO_COVERAGE | project1 | foo.bar | foo.bar.Foo | 10 | Replaced integer addition with subtraction | @@ -23,7 +23,7 @@ Feature: Mutation view shows analysis results Scenario: Selecting a mutation opens the class in question at the right line number When the following mutation is selected | status | project | package | class | line | mutation | - | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional | + | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false | Then the file "Foo.java" is opened at line number 9 Scenario: Using the stronger mutators yields more mutation results @@ -32,10 +32,10 @@ Feature: Mutation view shows analysis results Then a coverage report is generated with 2 classes tested with overall coverage of 80% and mutation coverage of 0% And the mutation results are | status | project | package | class | line | mutation | - | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional | | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false | - | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional | + | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with true | | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false | + | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with true | | NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | Replaced integer addition with subtraction | | NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | replaced int return with 0 for foo/bar/Bar::f | | NO_COVERAGE | project1 | foo.bar | foo.bar.Foo | 10 | Replaced integer addition with subtraction | @@ -52,14 +52,14 @@ Feature: Mutation view shows analysis results # And the mutation results are # | status | project | package | class | line | mutation | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | Substituted 1 with 0 | -# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional | +# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed call to java/util/ArrayList::size | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with true | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 12 | Substituted 0 with 1 | # | SURVIVED | project1 | foo.bar | foo.bar.Bar | 12 | replaced return of integer sized value with (x == 0 ? 1 : 0) | # | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | Substituted 1 with 0 | -# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional | +# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false | # | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed call to java/util/ArrayList::size | # | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false | # | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with true | diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java index 9cbca2ff..bedf35c1 100644 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java +++ b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java @@ -67,9 +67,6 @@ public SWTBotView getView() { SWTBotView mutationsView = bot.viewByTitle("PIT Mutations"); mutationsView.show(); mutationsView.setFocus(); - // Make sure the 'PIT Mutations' view is opened - // this should not be required anymore - // bot.waitUntil(new ViewOpenedCondition(bot, "PIT Mutations")); return mutationsView; } diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/ViewOpenedCondition.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/ViewOpenedCondition.java deleted file mode 100644 index 873d182b..00000000 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/ViewOpenedCondition.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.pitest.pitclipse.ui.behaviours.pageobjects; - -import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; -import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; - -class ViewOpenedCondition extends DefaultCondition { - - private SWTWorkbenchBot bot; - private String viewTitle; - - public ViewOpenedCondition(SWTWorkbenchBot bot, String viewTitle) { - this.bot = bot; - this.viewTitle = viewTitle; - } - - @Override - public boolean test() throws Exception { - return bot.viewByTitle(viewTitle).isActive(); - } - - @Override - public String getFailureMessage() { - return "The view '" + viewTitle + "' did not open"; - } -} \ No newline at end of file diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseOptionsTest.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseOptionsTest.java index 2e10a76e..f4016f66 100644 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseOptionsTest.java +++ b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseOptionsTest.java @@ -69,34 +69,13 @@ public void defaultOptions() { selector.close(); } - @Test - public void useOldDefaultsMutators() throws CoreException { - // set OLD_DEFAULTS mutators - PAGES.getWindowsMenu().setMutatorGroup(Mutators.OLD_DEFAULTS); - try { - runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT); - coverageReportGenerated(2, 80, 0, 8, 0); - mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)"); - } finally { - // it's crucial to reset it to the default or we break other tests - PAGES.getWindowsMenu().setMutatorGroup(Mutators.DEFAULTS); - } - } - @Test public void useDefaultMutators() throws CoreException { runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT); coverageReportGenerated(2, 80, 0, 6, 0); mutationsAre( - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" + + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + @@ -111,10 +90,10 @@ public void useStrongerMutators() throws CoreException { runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT); coverageReportGenerated(2, 80, 0, 8, 0); mutationsAre( - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with true\n" + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with true\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + @@ -188,7 +167,7 @@ public void launchConfigWithTargetClass() { // NOSONAR // run test and confirm result is as expected PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); coverageReportGenerated(1, 80, 0, 3, 0); - mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + + mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | replaced int return with 0 for foo/bar/Foo::f"); } diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipsePitMutationsViewTest.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipsePitMutationsViewTest.java index cda857e7..77db2dea 100644 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipsePitMutationsViewTest.java +++ b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipsePitMutationsViewTest.java @@ -1,5 +1,7 @@ package org.pitest.pitclipse.ui.tests; +import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withTitle; +import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -47,12 +49,16 @@ public void selectMutationOpensTheClassAtTheRightLineNumber() throws CoreExcepti coverageReportGenerated(2, 80, 0, 6, 0); PitclipseSteps pitclipseSteps = new PitclipseSteps(); PitMutation mutation = fromMutationLine( - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional"); + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false"); pitclipseSteps.doubleClickMutationInMutationsView(mutation); + + bot.waitUntil(waitForEditor(withTitle(FOO_CLASS + ".java"))); pitclipseSteps.mutationIsOpened(FOO_CLASS + ".java", 7); mutation = fromMutationLine( - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional"); + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false"); pitclipseSteps.doubleClickMutationInMutationsView(mutation); + + bot.waitUntil(waitForEditor(withTitle(BAR_CLASS + ".java"))); pitclipseSteps.mutationIsOpened(BAR_CLASS + ".java", 7); } diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseRunConfigurationMutationTabTest.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseRunConfigurationMutationTabTest.java index 06d373db..fcd0953c 100644 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseRunConfigurationMutationTabTest.java +++ b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseRunConfigurationMutationTabTest.java @@ -60,7 +60,6 @@ public void clearConsole() { @Test public void pressMutatorGroupButtons() { // NOSONAR - PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.OLD_DEFAULTS); PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.DEFAULTS); PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.STRONGER); PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.ALL); @@ -80,23 +79,6 @@ public void selectNoMutator() { // NOSONAR "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional"); } - @Test - public void useOldDefaultsMutatorsGroup() { // NOSONAR - // set OLD_DEFAULTS mutators - PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.OLD_DEFAULTS); - // run test and confirm result is as expected - PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); - coverageReportGenerated(TESTED_CLASSES, COVERAGE, 0, 8, 0); - mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)"); - } - @Test public void useDefaultMutatorsGroup() { // NOSONAR // set DEFAULTS mutators @@ -104,8 +86,8 @@ public void useDefaultMutatorsGroup() { // NOSONAR // run test and confirm result is as expected PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); coverageReportGenerated(TESTED_CLASSES, COVERAGE, 0, 6, 0); - mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + + mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + @@ -119,10 +101,10 @@ public void useStrongerMutatorsGroup() { // NOSONAR // run test and confirm result is as expected PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); coverageReportGenerated(TESTED_CLASSES, COVERAGE, 0, 8, 0); - mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + - "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" + + mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + + "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with true\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" + + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with true\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" + "NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + @@ -150,7 +132,7 @@ public void useAllMutatorsGroup() { // NOSONAR PAGES.getRunMenu().setMutatorGroup(TEST_CONFIG_NAME, Mutators.ALL); // run test and confirm result is as expected PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); - coverageReportGenerated(TESTED_CLASSES, COVERAGE, 1, 84, 1); + coverageReportGenerated(TESTED_CLASSES, COVERAGE, 5, 20, 1); mutationsAre(getAllMutantsResult()); } @@ -162,94 +144,31 @@ public void checkAllMutants() { // NOSONAR PAGES.getRunMenu().checkAllMutators(TEST_CONFIG_NAME); // run test and confirm result is as expected PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); - coverageReportGenerated(TESTED_CLASSES, COVERAGE, 1, 84, 1); + coverageReportGenerated(TESTED_CLASSES, COVERAGE, 5, 20, 1); mutationsAre(getAllMutantsResult()); } private String getAllMutantsResult(){ - return "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with -1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with -1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with 0\n" + + return "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with 0\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with 0\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | Substituted 1 with 2\n" + "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | negated conditional\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | not equal to equal\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | not equal to greater or equal\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | not equal to greater than\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | not equal to less or equal\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | not equal to less than\n" + "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | removed call to java/util/ArrayList::size\n" + "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" + "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with true\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | Substituted 0 with -1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | Substituted 0 with -1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | Substituted 0 with 1\n" + "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | Substituted 0 with 1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | Substituted 0 with 1\n" + - "SURVIVED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + "KILLED | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 6 | removed call to java/util/ArrayList::\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 6 | removed call to java/util/ArrayList::\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with 0\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | Substituted 1 with 2\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | negated conditional\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | not equal to equal\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | not equal to greater or equal\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | not equal to greater than\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | not equal to less or equal\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | not equal to less than\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | removed call to java/util/ArrayList::size\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with true\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Decremented (--a) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Decremented (a--) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Incremented (++a) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Incremented (a++) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Negated integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer addition with division\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer addition with modulus\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer addition with multiplication\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer operation by second member\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Replaced integer operation with first member\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with 0\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | Substituted 1 with 2\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | Substituted 0 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | Substituted 0 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | Substituted 0 with 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | Substituted 0 with 1\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | Substituted 0 with 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Bar | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Decremented (--a) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Decremented (a--) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Incremented (++a) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Incremented (a++) integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Negated integer local variable number 1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer addition with division\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer addition with modulus\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer addition with multiplication\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer operation by second member\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Replaced integer operation with first member\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with -1\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with 0\n" + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with 0\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | Substituted 1 with 2\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | replaced int return with 0 for foo/bar/Foo::f\n" + - "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)"; + "NO_COVERAGE | " + TEST_PROJECT + " |foo.bar | foo.bar.Foo | 8 | replaced int return with 0 for foo/bar/Foo::f\n"; } } diff --git a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseUiRunnerTest.java b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseUiRunnerTest.java index 229f3346..8a2a668d 100644 --- a/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseUiRunnerTest.java +++ b/tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseUiRunnerTest.java @@ -218,7 +218,7 @@ public void multipleLaunchConfigurations() throws CoreException { .choose(FOO_TEST_CLASS_MULTIPLE_LAUNCHES + " (All Mutators)")); // not just 2 mutants, but much more since in this launch // we enabled All Mutators - coverageReportGenerated(1, 0, 0, 20, 0); + coverageReportGenerated(1, 0, 0, 3, 0); @SuppressWarnings("serial") class MyException extends RuntimeException {