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 a651567be..7cc26e2a5 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 @@ -15,22 +15,17 @@ package org.pitest.mutationtest.engine.gregor.mutators; import static org.junit.Assert.assertEquals; +import static org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator.INCREMENTS; -import java.util.Collection; import java.util.concurrent.Callable; -import org.junit.Before; import org.junit.Test; -import org.pitest.mutationtest.engine.Mutant; import org.pitest.mutationtest.engine.MutationDetails; -import org.pitest.mutationtest.engine.gregor.MutatorTestBase; +import org.pitest.verifier.mutants.MutatorVerifierStart; -public class IncrementsMutatorTest extends MutatorTestBase { +public class IncrementsMutatorTest { - @Before - public void setupEngineToMutateOnlyIncrements() { - createTesteeWith(IncrementsMutator.INCREMENTS); - } + MutatorVerifierStart v = MutatorVerifierStart.forMutator(INCREMENTS); private static class HasIncrement implements Callable { public int containsIincInstructions(int i) { @@ -45,19 +40,16 @@ public String call() throws Exception { } @Test - public void shouldNegateArgumentsToIInc() throws Exception { - final Collection actual = findMutationsFor(HasIncrement.class); - assertEquals(1, actual.size()); - final Mutant mutant = getFirstMutant(actual); - assertMutantCallableReturns(new HasIncrement(), mutant, "0"); + public void shouldNegateArgumentsToIInc() { + v.forCallableClass(HasIncrement.class) + .firstMutantShouldReturn("0"); } @Test public void shouldRecordCorrectLineNumberForMutations() { - final Collection actual = findMutationsFor(HasIncrement.class); - assertEquals(1, actual.size()); - final MutationDetails first = actual.iterator().next(); - assertEquals(37, first.getLineNumber()); + MutationDetails actual = v.forClass(HasIncrement.class) + .firstMutant(); + assertEquals(32, actual.getLineNumber()); } } diff --git a/pitest/src/test/java/org/pitest/verifier/mutants/MutatorVerifier.java b/pitest/src/test/java/org/pitest/verifier/mutants/MutatorVerifier.java index 3aaec71bd..c0e8df3e9 100644 --- a/pitest/src/test/java/org/pitest/verifier/mutants/MutatorVerifier.java +++ b/pitest/src/test/java/org/pitest/verifier/mutants/MutatorVerifier.java @@ -35,11 +35,7 @@ public void noMutantsCreated() { } public StringAssert firstMutantIsDescription() { - List mutants = findMutations(); - assertThat(mutants) - .describedAs("No mutations created") - .isNotEmpty(); - return new StringAssert(findMutations().get(0).getDescription()); + return new StringAssert(firstMutant().getDescription()); } List findMutations() { @@ -49,4 +45,11 @@ List findMutations() { } + public MutationDetails firstMutant() { + List mutants = findMutations(); + assertThat(mutants) + .describedAs("No mutations created") + .isNotEmpty(); + return mutants.get(0); + } }