/** * Returns the name of the mutator that created this mutation * * @return the mutator name */ public String getMutator() { return this.id.getMutator(); }
private static Predicate<MethodMutatorFactory> isMutatorFor( final MutationIdentifier id) { return a -> id.getMutator().equals(a.getGloballyUniqueId()); }
@Override public int compareTo(final MutationIdentifier other) { int comp = this.location.compareTo(other.getLocation()); if (comp != 0) { return comp; } comp = this.mutator.compareTo(other.getMutator()); if (comp != 0) { return comp; } return this.indexes.get(0).compareTo(other.indexes.get(0)); }
@Override public boolean matches(MutationDetails value) { return value.getId().getMutator().equals(id); }
private SideEffect1<MutationResult> register() { return mr -> { MutationStatisticsPrecursor.this.numberOfTestsRun = MutationStatisticsPrecursor.this.numberOfTestsRun + mr.getNumberOfTestsRun(); final String key = mr.getDetails().getId().getMutator(); ScorePrecursor total = MutationStatisticsPrecursor.this.mutatorTotalMap .get(key); if (total == null) { total = new ScorePrecursor(key); MutationStatisticsPrecursor.this.mutatorTotalMap.put(key, total); } total.registerResult(mr.getStatus()); }; }
protected void assertMutantsAreFrom( final List<MutationDetails> actualDetails, final Class<?>... mutators) { assertEquals(mutators.length, actualDetails.size()); int i = 0; for (final MutationDetails each : actualDetails) { assertEquals(each.getId().getMutator(), mutators[i].getName()); i++; } }
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()); }
/** * Returns the name of the mutator that created this mutation * * @return the mutator name */ public String getMutator() { return this.id.getMutator(); }
@Test public void shouldRecordStatisticsAgainstMutators() { final MutationResult mr = makeResult(DetectionStatus.KILLED); this.testee.registerResults(Collections.singletonList(mr)); assertTrue(FCollection.contains(this.testee.getScores(), hasResultForMutator(mr.getDetails().getId().getMutator()))); }
@Test public void shouldGatherStatistics() { final MutationResult mr = makeResult(); this.testee.handleMutationResult(createMetaData(mr)); assertTrue(hasResultFor(mr.getDetails().getId().getMutator())); }
private static Predicate<MethodMutatorFactory> isMutatorFor( final MutationIdentifier id) { return a -> id.getMutator().equals(a.getGloballyUniqueId()); }
@Override public int compareTo(final MutationIdentifier other) { int comp = this.location.compareTo(other.getLocation()); if (comp != 0) { return comp; } comp = this.mutator.compareTo(other.getMutator()); if (comp != 0) { return comp; } return this.indexes.get(0).compareTo(other.indexes.get(0)); }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor methodVisitor = cv.visitMethod(access, name, desc, signature, exceptions); Location location = mID.getLocation(); if(location.getMethodDesc().equals(desc) && location.getMethodName().name().equals(name)) { return new MutationMethodAdapter( MutationOperator.fromID(mID.getMutator()), new Method(location.getMethodName().name(), location.getMethodDesc()), methodVisitor); } return methodVisitor; } }