CommentRangeEndRemoverVisitor.java

1
package pro.verron.officestamper.preset.preprocessors.malformedcomments;
2
3
import org.docx4j.utils.TraversalUtilVisitor;
4
import org.docx4j.wml.CommentRangeEnd;
5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7
8
import java.math.BigInteger;
9
import java.util.HashMap;
10
import java.util.List;
11
import java.util.Map;
12
13
class CommentRangeEndRemoverVisitor
14
        extends TraversalUtilVisitor<CommentRangeEnd> {
15
    private static final Logger log = LoggerFactory.getLogger(CommentRangeEndRemoverVisitor.class);
16
    private final List<BigInteger> ids;
17
    private final Map<Object, List<Object>> toRemove = new HashMap<>();
18
19
    public CommentRangeEndRemoverVisitor(List<BigInteger> ids) {
20
        this.ids = ids;
21
    }
22
23
    @Override public void apply(CommentRangeEnd element, Object parent, List<Object> siblings) {
24 1 1. apply : negated conditional → KILLED
        if (ids.contains(element.getId())) toRemove.put(element, siblings);
25
    }
26
27
    public void run() {
28
        log.debug("Removed Comment Range Ends: {}", toRemove);
29 1 1. run : removed call to java/util/Map::forEach → SURVIVED
        toRemove.forEach((object, siblings) -> siblings.remove(object));
30
    }
31
}

Mutations

24

1.1
Location : apply
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[method:fails()]
negated conditional → KILLED

29

1.1
Location : run
Killed by : none
removed call to java/util/Map::forEach → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.17.1