All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pitest.mutationtest.incremental.HistoryResultInterceptor Maven / Gradle / Ivy

There is a newer version: 1.17.1
Show newest version
package org.pitest.mutationtest.incremental;

import org.pitest.mutationtest.ClassMutationResults;
import org.pitest.mutationtest.History;
import org.pitest.mutationtest.MutationResultInterceptor;

import java.util.Collection;

/**
 * Records results for history before other interceptors are applied. Artificially
 * added via hacky hard coding.
 */
public class HistoryResultInterceptor implements MutationResultInterceptor {

    private final History history;

    public HistoryResultInterceptor(History historyStore) {
        this.history = historyStore;
    }

    @Override
    public Collection modify(Collection results) {
        results.stream()
                .flatMap(c -> c.getMutations().stream())
                .forEach(this.history::recordResult);
        return results;
    }

    @Override
    public int priority() {
        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy