public MutationDetails withDescription(String desc) { return new MutationDetails(this.id, this.filename, desc, this.lineNumber, this.block, this.isInFinallyBlock, this.poison); }
public MutationDetails withPoisonStatus(PoisonStatus poisonStatus) { return new MutationDetails(this.id, this.filename, this.description, this.lineNumber, this.block, this.isInFinallyBlock, poisonStatus); }
@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 MutationDetails makeMutantInHandlerBlock(final int line, final int block, final String mutator, final int index) { return new MutationDetails(makeId(Collections.singleton(index), mutator), "file", "desc", line, block, true, PoisonStatus.NORMAL); }
private MutationDetails makeMutant(final int line, final int block, final String mutator, final Collection<Integer> indexes) { return new MutationDetails(makeId(new HashSet<>(indexes), mutator), "file", "desc", line, block); }
private MutationDetails makeMutantInHandlerBlock(final int line, final int block, final String mutator, final Collection<Integer> indexes) { return new MutationDetails(makeId(new HashSet<>(indexes), mutator), "file", "desc", line, block, true, PoisonStatus.NORMAL); }
private MutationDetails makeMutation(final int id) { return new MutationDetails(makeId(id), "", "", 0, 0); }
private void addMutation() { this.mutations.add(new MutationDetails(aMutationId().build(), "file", "desc", 0, 0)); }
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()); }
@Override public MutationIdentifier registerMutation( final MethodMutatorFactory factory, final String description) { final MutationIdentifier newId = getNextMutationIdentifer(factory, this.classContext.getJavaClassName()); final MutationDetails details = new MutationDetails(newId, this.classContext.getFileName(), description, this.lastLineNumber, this.classContext.getCurrentBlock(), this.classContext.isWithinFinallyBlock(), PoisonStatus.NORMAL); registerMutation(details); return newId; }
@Test public void shouldReportErrorWhenOneOccursDuringAnalysis() { this.mutations.add(new MutationDetails(aMutationId().withIndex(0) .withMutator("foo").build(), "file", "desc", 0, 0)); when(this.mutater.getMutation(any(MutationIdentifier.class))).thenThrow( new PitError("foo")); this.testee.run(); verify(this.reporter).done(ExitCode.UNKNOWN_ERROR); }
@Before public void setUp() { this.interceptedClass = new AClassWithAOpenClassFileMethod(); final byte[] bytes = "replaced".getBytes(); this.mutant = new Mutant(new MutationDetails(aMutationId().withLocation( aLocation().withClass(ClassName.fromString("match"))).build(), "foo", "foo", 0, 0), bytes); }
public static MutationDetails createDetails(String clazz) { return new MutationDetails(aMutationId().withLocation(aLocation(clazz)) .build(), "", "desc", 42, 0); }
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 = aMutationId().withLocation( aLocation().withMethod(method)).build(); 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); }
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); }
public static MutationDetails createDetails(final String clazz) { final LocationBuilder lb = LocationMother.aLocation().withClass( ClassName.fromString(clazz)); return new MutationDetails(aMutationId().withLocation(lb).build(), "", "desc", 42, 0); }
public MutationDetails makeMutant(final String clazz, final int index) { final MutationIdentifier id = aMutationId() .withLocation(aLocation().withClass(ClassName.fromString(clazz))) .withIndex(index).withMutator("mutator").build(); final MutationDetails md = new MutationDetails(id, "sourceFile", "desc", 42, 0); when(this.mutater.getMutation(md.getId())).thenReturn( new Mutant(md, new byte[0])); return md; }
private static Generator<MutationDetailsBuilder, MutationDetails> seed() { return b -> { final MutationDetails md = new MutationDetails(b._Id(), b._Filename(), b._Description(), b._LineNumber(), b._Block(), b._IsInFinallyBlock(), b._Poison()); md.addTestsInOrder(b._TestsInOrder()); return md; }; }