StandardParagraph.java

1
package pro.verron.officestamper.core;
2
3
import jakarta.xml.bind.JAXBElement;
4
import org.docx4j.wml.*;
5
import pro.verron.officestamper.api.*;
6
import pro.verron.officestamper.utils.WmlFactory;
7
8
import java.math.BigInteger;
9
import java.util.*;
10
import java.util.function.Consumer;
11
12
import static java.util.Arrays.stream;
13
import static java.util.stream.Collectors.joining;
14
import static pro.verron.officestamper.api.OfficeStamperException.throwing;
15
import static pro.verron.officestamper.utils.WmlUtils.getFirstParentWithClass;
16
17
/**
18
 * <p>A "Run" defines a region of text within a docx document with a common set of properties. Word processors are
19
 * relatively free in splitting a paragraph of text into multiple runs, so there is no strict rule to say over how many
20
 * runs a word or a string of words is spread.</p>
21
 * <p>This class aggregates multiple runs so they can be treated as a single text, no matter how many runs the text
22
 * spans.
23
 * Create a {@link StandardParagraph} then, call methods to modify the aggregated text.
24
 * Finally, call {@link #asString()} to get the modified text.
25
 *
26
 * @author Joseph Verron
27
 * @author Tom Hombergs
28
 * @version ${version}
29
 * @since 1.0.8
30
 */
31
public class StandardParagraph
32
        implements Paragraph {
33
34
    private static final Random RANDOM = new Random();
35
    private final DocxPart source;
36
    private final List<Object> contents;
37
    private final P p;
38
    private List<IndexedRun> runs;
39
40
    private StandardParagraph(DocxPart source, List<Object> paragraphContent, P p) {
41
        this.source = source;
42
        this.contents = paragraphContent;
43
        this.p = p;
44
        this.runs = initializeRunList(contents);
45
    }
46
47
48
    /**
49
     * Calculates the runs of the paragraph.
50
     * This method is called automatically by the constructor, but can also be
51
     * called manually to recalculate the runs after a modification to the paragraph was done.
52
     */
53
    private static List<IndexedRun> initializeRunList(List<Object> objects) {
54
        int currentLength = 0;
55
        var runList = new ArrayList<IndexedRun>(objects.size());
56 2 1. initializeRunList : changed conditional boundary → KILLED
2. initializeRunList : negated conditional → KILLED
        for (int i = 0; i < objects.size(); i++) {
57
            Object object = objects.get(i);
58 1 1. initializeRunList : negated conditional → KILLED
            if (object instanceof R run) {
59 1 1. initializeRunList : Replaced integer addition with subtraction → KILLED
                int nextLength = currentLength + RunUtil.getLength(run);
60
                runList.add(new IndexedRun(currentLength, nextLength, i, run));
61
                currentLength = nextLength;
62
            }
63
        }
64 1 1. initializeRunList : replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::initializeRunList → KILLED
        return runList;
65
    }
66
67
    /**
68
     * Constructs a new ParagraphWrapper for the given paragraph.
69
     */
70
    public static StandardParagraph from(DocxPart source, P paragraph) {
71 1 1. from : replaced return value with null for pro/verron/officestamper/core/StandardParagraph::from → KILLED
        return new StandardParagraph(source, paragraph.getContent(), paragraph);
72
    }
73
74
    /**
75
     * Constructs a StandardParagraph from a given CTSdtContentRun paragraph.
76
     *
77
     * @param paragraph a CTSdtContentRun object representing the content run of the paragraph
78
     *
79
     * @return a new instance of StandardParagraph based on the provided CTSdtContentRun
80
     */
81
    public static StandardParagraph from(DocxPart source, CTSdtContentRun paragraph) {
82
        var p = WmlFactory.newParagraph(paragraph.getContent());
83 1 1. from : removed call to org/docx4j/wml/P::setParent → SURVIVED
        p.setParent(paragraph.getParent());
84 1 1. from : replaced return value with null for pro/verron/officestamper/core/StandardParagraph::from → KILLED
        return new StandardParagraph(source, paragraph.getContent(), p);
85
    }
86
87
    @Override public ProcessorContext processorContext(Placeholder placeholder) {
88
        var comment = comment(placeholder);
89
        var firstRun = (R) contents.getFirst();
90 1 1. processorContext : replaced return value with null for pro/verron/officestamper/core/StandardParagraph::processorContext → KILLED
        return new ProcessorContext(this, firstRun, comment, placeholder);
91
    }
92
93
    @Override public void replace(List<P> toRemove, List<P> toAdd) {
94
        int index = siblings().indexOf(p);
95 2 1. replace : changed conditional boundary → SURVIVED
2. replace : negated conditional → KILLED
        if (index < 0) throw new OfficeStamperException("Impossible");
96
        siblings().addAll(index, toAdd);
97
        siblings().removeAll(toRemove);
98
    }
99
100
    private List<Object> siblings() {
101 1 1. siblings : replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::siblings → KILLED
        return this.parent(ContentAccessor.class, 1)
102
                   .orElseThrow(throwing("This paragraph direct parent is not a classic parent object"))
103
                   .getContent();
104
    }
105
106
    private <T> Optional<T> parent(Class<T> aClass, int depth) {
107 1 1. parent : replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::parent → KILLED
        return getFirstParentWithClass(p, aClass, depth);
108
    }
109
110
    @Override public void remove() {
111 1 1. remove : removed call to pro/verron/officestamper/core/ObjectDeleter::deleteParagraph → KILLED
        ObjectDeleter.deleteParagraph(p);
112
    }
113
114
    /**
115
     * Retrieves the P object associated with this StandardParagraph.
116
     *
117
     * @return the P object of this paragraph.
118
     *
119
     * @deprecated Not recommended, as will be replaced by other API
120
     */
121
    @Deprecated(since = "2.6", forRemoval = true) @Override public P getP() {
122 1 1. getP : replaced return value with null for pro/verron/officestamper/core/StandardParagraph::getP → NO_COVERAGE
        return p;
123
    }
124
125
    /**
126
     * Replaces the given expression with the replacement object within
127
     * the paragraph.
128
     * The replacement object must be a valid DOCX4J Object.
129
     *
130
     * @param placeholder the expression to be replaced.
131
     * @param replacement the object to replace the expression.
132
     */
133
    @Override public void replace(Placeholder placeholder, Object replacement) {
134 1 1. replace : negated conditional → KILLED
        if (replacement instanceof R run) {
135 1 1. replace : removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithRun → KILLED
            replaceWithRun(placeholder, run);
136
        }
137 1 1. replace : negated conditional → KILLED
        else if (replacement instanceof Br br) {
138 1 1. replace : removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithBr → KILLED
            replaceWithBr(placeholder, br);
139
        }
140
        else {
141
            throw new AssertionError("Replacement must be a R or Br, but was a " + replacement.getClass());
142
        }
143
    }
144
145
    /**
146
     * Returns the aggregated text over all runs.
147
     *
148
     * @return the text of all runs.
149
     */
150
    @Override public String asString() {
151 1 1. asString : replaced return value with "" for pro/verron/officestamper/core/StandardParagraph::asString → KILLED
        return runs.stream()
152
                   .map(IndexedRun::run)
153
                   .map(RunUtil::getText)
154
                   .collect(joining());
155
    }
156
157
    @Override public void apply(Consumer<P> pConsumer) {
158 1 1. apply : removed call to java/util/function/Consumer::accept → KILLED
        pConsumer.accept(p);
159
    }
160
161
    @Override public <T> Optional<T> parent(Class<T> aClass) {
162 1 1. parent : replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::parent → KILLED
        return parent(aClass, Integer.MAX_VALUE);
163
    }
164
165
    @Override public Optional<Comments.Comment> getComment() {
166 1 1. getComment : replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::getComment → KILLED
        return CommentUtil.getCommentFor(contents, source.document());
167
    }
168
169
    private void replaceWithRun(Placeholder placeholder, R replacement) {
170
        var text = asString();
171
        String full = placeholder.expression();
172
173
        int matchStartIndex = text.indexOf(full);
174 1 1. replaceWithRun : negated conditional → KILLED
        if (matchStartIndex == -1) {
175
            // nothing to replace
176
            return;
177
        }
178 1 1. replaceWithRun : Replaced integer addition with subtraction → KILLED
        int matchEndIndex = matchStartIndex + full.length();
179
        List<IndexedRun> affectedRuns = getAffectedRuns(matchStartIndex, matchEndIndex);
180
181 1 1. replaceWithRun : negated conditional → KILLED
        boolean singleRun = affectedRuns.size() == 1;
182
183 1 1. replaceWithRun : negated conditional → KILLED
        if (singleRun) {
184
            IndexedRun run = affectedRuns.getFirst();
185
186 1 1. replaceWithRun : negated conditional → KILLED
            boolean expressionSpansCompleteRun = full.length() == run.length();
187 1 1. replaceWithRun : negated conditional → KILLED
            boolean expressionAtStartOfRun = matchStartIndex == run.startIndex();
188 1 1. replaceWithRun : negated conditional → KILLED
            boolean expressionAtEndOfRun = matchEndIndex == run.endIndex();
189 4 1. replaceWithRun : changed conditional boundary → SURVIVED
2. replaceWithRun : changed conditional boundary → SURVIVED
3. replaceWithRun : negated conditional → KILLED
4. replaceWithRun : negated conditional → KILLED
            boolean expressionWithinRun = matchStartIndex > run.startIndex() && matchEndIndex <= run.endIndex();
190
191 1 1. replaceWithRun : removed call to org/docx4j/wml/R::setRPr → SURVIVED
            replacement.setRPr(run.getPr());
192
193 1 1. replaceWithRun : negated conditional → KILLED
            if (expressionSpansCompleteRun) {
194
                contents.set(run.indexInParent(), replacement);
195
            }
196 1 1. replaceWithRun : negated conditional → KILLED
            else if (expressionAtStartOfRun) {
197 1 1. replaceWithRun : removed call to pro/verron/officestamper/core/IndexedRun::replace → NO_COVERAGE
                run.replace(matchStartIndex, matchEndIndex, "");
198 1 1. replaceWithRun : removed call to java/util/List::add → NO_COVERAGE
                contents.add(run.indexInParent(), replacement);
199
            }
200 1 1. replaceWithRun : negated conditional → KILLED
            else if (expressionAtEndOfRun) {
201 1 1. replaceWithRun : removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED
                run.replace(matchStartIndex, matchEndIndex, "");
202 2 1. replaceWithRun : Replaced integer addition with subtraction → KILLED
2. replaceWithRun : removed call to java/util/List::add → KILLED
                contents.add(run.indexInParent() + 1, replacement);
203
            }
204 1 1. replaceWithRun : negated conditional → KILLED
            else if (expressionWithinRun) {
205
                int startIndex = run.indexOf(full);
206 1 1. replaceWithRun : Replaced integer addition with subtraction → KILLED
                int endIndex = startIndex + full.length();
207
                var newStartRun = RunUtil.create(run.substring(0, startIndex),
208
                        run.run()
209
                           .getRPr());
210
                var newEndRun = RunUtil.create(run.substring(endIndex),
211
                        run.run()
212
                           .getRPr());
213
                contents.remove(run.indexInParent());
214
                contents.addAll(run.indexInParent(), List.of(newStartRun, replacement, newEndRun));
215
            }
216
        }
217
        else {
218
            IndexedRun firstRun = affectedRuns.getFirst();
219
            IndexedRun lastRun = affectedRuns.getLast();
220 1 1. replaceWithRun : removed call to org/docx4j/wml/R::setRPr → KILLED
            replacement.setRPr(firstRun.getPr());
221 1 1. replaceWithRun : removed call to pro/verron/officestamper/core/StandardParagraph::removeExpression → KILLED
            removeExpression(firstRun, matchStartIndex, matchEndIndex, lastRun, affectedRuns);
222
            // add replacement run between first and last run
223 2 1. replaceWithRun : removed call to java/util/List::add → KILLED
2. replaceWithRun : Replaced integer addition with subtraction → KILLED
            contents.add(firstRun.indexInParent() + 1, replacement);
224
        }
225
        this.runs = initializeRunList(contents);
226
    }
227
228
    private void replaceWithBr(Placeholder placeholder, Br br) {
229
        for (IndexedRun indexedRun : runs) {
230
            var runContentIterator = indexedRun.run()
231
                                               .getContent()
232
                                               .listIterator();
233 1 1. replaceWithBr : negated conditional → KILLED
            while (runContentIterator.hasNext()) {
234
                Object element = runContentIterator.next();
235 1 1. replaceWithBr : negated conditional → KILLED
                if (element instanceof JAXBElement<?> jaxbElement) element = jaxbElement.getValue();
236 2 1. replaceWithBr : removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithBr → KILLED
2. replaceWithBr : negated conditional → KILLED
                if (element instanceof Text text) replaceWithBr(placeholder, br, text, runContentIterator);
237
            }
238
        }
239
    }
240
241
    private List<IndexedRun> getAffectedRuns(int startIndex, int endIndex) {
242 1 1. getAffectedRuns : replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::getAffectedRuns → KILLED
        return runs.stream()
243 2 1. lambda$getAffectedRuns$0 : replaced boolean return with true for pro/verron/officestamper/core/StandardParagraph::lambda$getAffectedRuns$0 → KILLED
2. lambda$getAffectedRuns$0 : replaced boolean return with false for pro/verron/officestamper/core/StandardParagraph::lambda$getAffectedRuns$0 → KILLED
                   .filter(run -> run.isTouchedByRange(startIndex, endIndex))
244
                   .toList();
245
    }
246
247
    private void removeExpression(
248
            IndexedRun firstRun,
249
            int matchStartIndex,
250
            int matchEndIndex,
251
            IndexedRun lastRun,
252
            List<IndexedRun> affectedRuns
253
    ) {
254
        // remove the expression from the first run
255 1 1. removeExpression : removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED
        firstRun.replace(matchStartIndex, matchEndIndex, "");
256
        // remove all runs between first and last
257
        for (IndexedRun run : affectedRuns) {
258 2 1. removeExpression : negated conditional → KILLED
2. removeExpression : negated conditional → KILLED
            if (!Objects.equals(run, firstRun) && !Objects.equals(run, lastRun)) {
259
                contents.remove(run.run());
260
            }
261
        }
262
        // remove the expression from the last run
263 1 1. removeExpression : removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED
        lastRun.replace(matchStartIndex, matchEndIndex, "");
264
    }
265
266
    private static void replaceWithBr(
267
            Placeholder placeholder, Br br, Text text, ListIterator<Object> runContentIterator
268
    ) {
269
        var value = text.getValue();
270 1 1. replaceWithBr : removed call to java/util/ListIterator::remove → KILLED
        runContentIterator.remove();
271
        var runLinebreakIterator = stream(value.split(placeholder.expression())).iterator();
272 1 1. replaceWithBr : negated conditional → KILLED
        while (runLinebreakIterator.hasNext()) {
273
            var subText = WmlFactory.newText(runLinebreakIterator.next());
274 1 1. replaceWithBr : removed call to java/util/ListIterator::add → KILLED
            runContentIterator.add(subText);
275 2 1. replaceWithBr : removed call to java/util/ListIterator::add → KILLED
2. replaceWithBr : negated conditional → KILLED
            if (runLinebreakIterator.hasNext()) runContentIterator.add(br);
276
        }
277
    }
278
279
    private Comment comment(Placeholder placeholder) {
280
        var id = new BigInteger(16, RANDOM);
281 1 1. comment : replaced return value with null for pro/verron/officestamper/core/StandardParagraph::comment → KILLED
        return StandardComment.create(source.document(), p, placeholder, id);
282
    }
283
284
    /**
285
     * {@inheritDoc}
286
     */
287
    @Override public String toString() {
288 1 1. toString : replaced return value with "" for pro/verron/officestamper/core/StandardParagraph::toString → NO_COVERAGE
        return asString();
289
    }
290
291
}

Mutations

56

1.1
Location : initializeRunList
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
changed conditional boundary → KILLED

2.2
Location : initializeRunList
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
negated conditional → KILLED

58

1.1
Location : initializeRunList
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
negated conditional → KILLED

59

1.1
Location : initializeRunList
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
Replaced integer addition with subtraction → KILLED

64

1.1
Location : initializeRunList
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::initializeRunList → KILLED

71

1.1
Location : from
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
replaced return value with null for pro/verron/officestamper/core/StandardParagraph::from → KILLED

83

1.1
Location : from
Killed by : none
removed call to org/docx4j/wml/P::setParent → SURVIVED
Covering tests

84

1.1
Location : from
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#39]
replaced return value with null for pro/verron/officestamper/core/StandardParagraph::from → KILLED

90

1.1
Location : processorContext
Killed by : pro.verron.officestamper.test.SpelInjectionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInjectionTest]/[method:spelInjectionTest()]
replaced return value with null for pro/verron/officestamper/core/StandardParagraph::processorContext → KILLED

95

1.1
Location : replace
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
negated conditional → KILLED

2.2
Location : replace
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

101

1.1
Location : siblings
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::siblings → KILLED

107

1.1
Location : parent
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#22]
replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::parent → KILLED

111

1.1
Location : remove
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#20]
removed call to pro/verron/officestamper/core/ObjectDeleter::deleteParagraph → KILLED

122

1.1
Location : getP
Killed by : none
replaced return value with null for pro/verron/officestamper/core/StandardParagraph::getP → NO_COVERAGE

134

1.1
Location : replace
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

135

1.1
Location : replace
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithRun → KILLED

137

1.1
Location : replace
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

138

1.1
Location : replace
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#34]
removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithBr → KILLED

151

1.1
Location : asString
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#30]
replaced return value with "" for pro/verron/officestamper/core/StandardParagraph::asString → KILLED

158

1.1
Location : apply
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#38]
removed call to java/util/function/Consumer::accept → KILLED

162

1.1
Location : parent
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#22]
replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::parent → KILLED

166

1.1
Location : getComment
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[method:fails()]
replaced return value with Optional.empty for pro/verron/officestamper/core/StandardParagraph::getComment → KILLED

174

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

178

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
Replaced integer addition with subtraction → KILLED

181

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

183

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

186

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

187

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

188

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

189

1.1
Location : replaceWithRun
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

2.2
Location : replaceWithRun
Killed by : none
changed conditional boundary → SURVIVED Covering tests

3.3
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

4.4
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

191

1.1
Location : replaceWithRun
Killed by : none
removed call to org/docx4j/wml/R::setRPr → SURVIVED
Covering tests

193

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

196

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

197

1.1
Location : replaceWithRun
Killed by : none
removed call to pro/verron/officestamper/core/IndexedRun::replace → NO_COVERAGE

198

1.1
Location : replaceWithRun
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

200

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

201

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#37]
removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED

202

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#37]
Replaced integer addition with subtraction → KILLED

2.2
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#37]
removed call to java/util/List::add → KILLED

204

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
negated conditional → KILLED

206

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#25]
Replaced integer addition with subtraction → KILLED

220

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#28]
removed call to org/docx4j/wml/R::setRPr → KILLED

221

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to pro/verron/officestamper/core/StandardParagraph::removeExpression → KILLED

223

1.1
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to java/util/List::add → KILLED

2.2
Location : replaceWithRun
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
Replaced integer addition with subtraction → KILLED

233

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#34]
negated conditional → KILLED

235

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

236

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#34]
removed call to pro/verron/officestamper/core/StandardParagraph::replaceWithBr → KILLED

2.2
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#34]
negated conditional → KILLED

242

1.1
Location : getAffectedRuns
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/StandardParagraph::getAffectedRuns → KILLED

243

1.1
Location : lambda$getAffectedRuns$0
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#16]
replaced boolean return with true for pro/verron/officestamper/core/StandardParagraph::lambda$getAffectedRuns$0 → KILLED

2.2
Location : lambda$getAffectedRuns$0
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
replaced boolean return with false for pro/verron/officestamper/core/StandardParagraph::lambda$getAffectedRuns$0 → KILLED

255

1.1
Location : removeExpression
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED

258

1.1
Location : removeExpression
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

2.2
Location : removeExpression
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

263

1.1
Location : removeExpression
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to pro/verron/officestamper/core/IndexedRun::replace → KILLED

270

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to java/util/ListIterator::remove → KILLED

272

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

274

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
removed call to java/util/ListIterator::add → KILLED

275

1.1
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#34]
removed call to java/util/ListIterator::add → KILLED

2.2
Location : replaceWithBr
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#28]
negated conditional → KILLED

281

1.1
Location : comment
Killed by : pro.verron.officestamper.test.SpelInjectionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInjectionTest]/[method:spelInjectionTest()]
replaced return value with null for pro/verron/officestamper/core/StandardParagraph::comment → KILLED

288

1.1
Location : toString
Killed by : none
replaced return value with "" for pro/verron/officestamper/core/StandardParagraph::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.17.1