protected Predicate<MutationDetails> descriptionContaining(final String value) { return a -> a.getDescription().contains(value); }
protected void assertMutantDescriptionIncludes(String string, Class<?> clazz) { final Collection<MutationDetails> actual = findMutationsFor(clazz); assertThat(actual.iterator().next().getDescription()).contains(string); } }
private static MutationDetails makeCombinedMutant( final Collection<MutationDetails> value) { final MutationDetails first = value.iterator().next(); final Set<Integer> indexes = new HashSet<>(); mapTo(value, mutationToIndex(), indexes); final MutationIdentifier id = new MutationIdentifier(first.getId() .getLocation(), indexes, first.getId().getMutator()); return new MutationDetails(id, first.getFilename(), first.getDescription(), first.getLineNumber(), first.getBlock()); }
@Test public void shouldDescribeReplacementOfEqualityChecksWithFalse() { createTesteeWith(new RemoveConditionalMutator(Choice.EQUAL, false)); final Mutant mutant = getFirstMutant(HasIFEQ.class); assertThat(mutant.getDetails().getDescription()).contains( "equality check with false"); }
@Test public void shouldDescribeReplacementOfOrderCheckWithFalse() throws Exception { createTesteeWith(new RemoveConditionalMutator(Choice.ORDER, false)); final Mutant mutant = getFirstMutant(HasIFLE.class); assertThat(mutant.getDetails().getDescription()).contains( " comparison check with false"); }
@Test public void shouldDescribeReplacementOfEqualityChecksWithTrue() { createTesteeWith(new RemoveConditionalMutator(Choice.EQUAL, true)); final Mutant mutant = getFirstMutant(HasIFEQ.class); assertThat(mutant.getDetails().getDescription()).contains( "equality check with true"); }
@Test public void shouldDescribeReplacementOfOrderCheckWithTrue() throws Exception { createTesteeWith(new RemoveConditionalMutator(Choice.ORDER, true)); final Mutant mutant = getFirstMutant(HasIFLE.class); assertThat(mutant.getDetails().getDescription()).contains( " comparison check with true"); }
private String makeMutationNode(final MutationResult mutation) { final MutationDetails details = mutation.getDetails(); return makeNode(clean(details.getFilename()), sourceFile) + makeNode(clean(details.getClassName().asJavaName()), mutatedClass) + makeNode(clean(details.getMethod().name()), mutatedMethod) + makeNode(clean(details.getId().getLocation().getMethodDesc()), methodDescription) + makeNode("" + details.getLineNumber(), lineNumber) + makeNode(clean(details.getMutator()), mutator) + makeNode("" + details.getFirstIndex(), index) + makeNode("" + details.getBlock(), block) + makeNodeWhenConditionSatisfied(!fullMutationMatrix, createKillingTestDesc(mutation.getKillingTest()), killingTest) + makeNodeWhenConditionSatisfied(fullMutationMatrix, createTestDesc(mutation.getKillingTests()), killingTests) + makeNodeWhenConditionSatisfied(fullMutationMatrix, createTestDesc(mutation.getSucceedingTests()), succeedingTests) + makeNode(clean(details.getDescription()), description); }
p("The following transformations were applied but they were not detected by the test suite:"), ul( each(method.getUndetectedMutations(), mutation -> li(mutation.getDetails().getDescription()))) ); document.with(p("The following transformations were detected by the test suite when applied."), ul(each(method.getDetectedMutations(), mutation -> li(mutation.getDetails().getDescription()))));
private String makeMutationNode(MutationResult mutation) { MutationDetails details = mutation.getDetails(); return makeNode(clean(details.getFilename()), Tag.sourceFile) + makeNode(clean(details.getClassName().asJavaName()), Tag.mutatedClass) + makeNode(clean(details.getMethod().name()), Tag.mutatedMethod) + makeNode(clean(details.getId().getLocation().getMethodDesc()), Tag.methodDescription) + makeNode("" + details.getLineNumber(), Tag.lineNumber) + makeNode(clean(details.getMutator()), Tag.mutator) + makeNode("" + details.getFirstIndex(), Tag.index) + makeNode(createKillingTestDesc(mutation.getKillingTest()), Tag.killingTest) + makeTestInfoNode(details) + makeNode(clean(details.getDescription()), Tag.description); }