private MutationIdentifier getNextMutationIdentifer( final MethodMutatorFactory factory, final String className) { return new MutationIdentifier(this.location, this.instructionIndex, factory.getGloballyUniqueId()); }
@Override protected MutationResult mapToData(final Map<String, Object> map) { final Location location = new Location(ClassName.fromString((String) map.get(MUTATED_CLASS)), MethodName.fromString((String) map.get(MUTATED_METHOD)), (String) map.get(METHOD_DESCRIPTION)); final MutationIdentifier id = new MutationIdentifier(location, Arrays.asList(new Integer((String) map.get(INDEX))), (String) map.get(MUTATOR)); final MutationDetails md = new MutationDetails(id, (String) map.get(SOURCE_FILE), (String) map.get(DESCRIPTION), Integer.parseInt((String) map.get(LINE_NUMBER)), Integer.parseInt((String) map.get(BLOCK))); final MutationStatusTestPair status = new MutationStatusTestPair(Integer.parseInt((String) map.get(NUMBER_OF_TESTS_RUN)), DetectionStatus.valueOf((String) map.get(STATUS)), (String) map.get(KILLING_TEST)); return new MutationResult(md, status); }
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()); }
private MutationIdentifier makeId(final Set<Integer> indexes, final String mutator) { return new MutationIdentifier(aLocation().build(), indexes, mutator); }
public static MutationDetails makeMutation(final ClassName clazz) { return new MutationDetails(new MutationIdentifier(Location.location(clazz, new MethodName("aMethod"), "()V"), 1, "mutatorId"), "foo.java", "A mutation", 0, 0); }
@Test public void shouldMatchWhenIndexesOverlap() { final MutationIdentifier a = new MutationIdentifier(aLocation().build(), new HashSet<>(Arrays.asList(1, 2)), "M"); final MutationIdentifier b = new MutationIdentifier(aLocation().build(), 1, "M"); assertTrue(a.matches(b)); }
@Test public void shouldNotMatchWhenIndexesDoNotOverlap() { final MutationIdentifier a = new MutationIdentifier(aLocation().build(), new HashSet<Integer>(100, 200), "M"); final MutationIdentifier b = new MutationIdentifier(aLocation().build(), 1, "M"); assertFalse(a.matches(b)); }
private static Generator<MutationIdentifierBuilder, MutationIdentifier> idSeed() { return b -> new MutationIdentifier(b._Location(), b._Index(), b._Mutator()); } }
@Test public void shouldNotMatchWhenLocationsDiffer() { final MutationIdentifier a = new MutationIdentifier(aLocation() .withMethodDescription("X").build(), 1, "M"); final MutationIdentifier b = new MutationIdentifier(aLocation() .withMethodDescription("Y").build(), 1, "M"); assertFalse(a.matches(b)); }
private MutationDetails makeMutation(final String method) { final MutationIdentifier id = new MutationIdentifier(aLocation() .withClass(this.foo).withMethod(method).build(), 0, "mutator"); return new MutationDetails(id, "file", "desc", 1, 2); }
private MutationDetails makeMutation(final String method) { final MutationIdentifier id = new MutationIdentifier(aLocation() .withClass(this.foo).withMethod(method).build(), 0, "mutator"); return new MutationDetails(id, "file", "desc", 1, 2); }
private MutationIdentifier getNextMutationIdentifer( final MethodMutatorFactory factory, final String className) { return new MutationIdentifier(this.location, this.instructionIndex, factory.getGloballyUniqueId()); }
private MutationDetails getMutationDetails(Method method, MutationOperator operator, int start, int end) { Location location = new Location(className, MethodName.fromString(method.getName()), method.getDescriptor()); MutationIdentifier id = new MutationIdentifier( location, getIndexes(start, end), operator.getID()); return new MutationDetails(id, source, operator.getDescription(), start, 1); }