PowerpointParagraph.java

1
package pro.verron.officestamper.experimental;
2
3
import org.docx4j.dml.CTRegularTextRun;
4
import org.docx4j.dml.CTTextCharacterProperties;
5
import org.docx4j.dml.CTTextParagraph;
6
import org.docx4j.wml.Comments;
7
import org.docx4j.wml.ContentAccessor;
8
import org.docx4j.wml.P;
9
import org.docx4j.wml.R;
10
import pro.verron.officestamper.api.*;
11
import pro.verron.officestamper.core.CommentUtil;
12
import pro.verron.officestamper.core.StandardComment;
13
import pro.verron.officestamper.utils.WmlFactory;
14
import pro.verron.officestamper.utils.WmlUtils;
15
16
import java.math.BigInteger;
17
import java.util.*;
18
import java.util.function.Consumer;
19
20
import static java.util.Optional.ofNullable;
21
import static java.util.stream.Collectors.joining;
22
import static pro.verron.officestamper.api.OfficeStamperException.throwing;
23
24
/**
25
 * <p>A "Run" defines a region of text within a docx document with a common set of properties. Word processors are
26
 * relatively free in splitting a paragraph of text into multiple runs, so there is no strict rule to say over how many
27
 * runs a word or a string of words is spread.</p>
28
 * <p>This class aggregates multiple runs so they can be treated as a single text, no matter how many runs the text
29
 * spans.
30
 *
31
 * @author Joseph Verron
32
 * @author Tom Hombergs
33
 * @version ${version}
34
 * @since 1.0.8
35
 */
36
public class PowerpointParagraph
37
        implements Paragraph {
38
39
    private static final Random RANDOM = new Random();
40
    private final DocxPart source;
41
    private final List<PowerpointRun> runs = new ArrayList<>();
42
    private final CTTextParagraph paragraph;
43
    private int currentPosition = 0;
44
45
    /**
46
     * Constructs a new ParagraphWrapper for the given paragraph.
47
     *
48
     * @param paragraph the paragraph to wrap.
49
     */
50
    public PowerpointParagraph(PptxPart source, CTTextParagraph paragraph) {
51
        this.source = source;
52
        this.paragraph = paragraph;
53 1 1. <init> : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → KILLED
        recalculateRuns();
54
    }
55
56
    /**
57
     * Recalculates the runs of the paragraph. This method is called automatically by the constructor, but can also be
58
     * called manually to recalculate the runs after a modification to the paragraph was done.
59
     */
60
    private void recalculateRuns() {
61
        currentPosition = 0;
62 1 1. recalculateRuns : removed call to java/util/List::clear → SURVIVED
        this.runs.clear();
63
        int index = 0;
64
        for (Object contentElement : paragraph.getEGTextRun()) {
65 1 1. recalculateRuns : negated conditional → KILLED
            if (contentElement instanceof CTRegularTextRun r && !r.getT()
66 1 1. recalculateRuns : negated conditional → KILLED
                                                                  .isEmpty()) {
67 1 1. recalculateRuns : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::addRun → KILLED
                this.addRun(r, index);
68
            }
69 1 1. recalculateRuns : Changed increment from 1 to -1 → SURVIVED
            index++;
70
        }
71
    }
72
73
    /**
74
     * Adds a run to the aggregation.
75
     *
76
     * @param run the run to add.
77
     */
78
    private void addRun(CTRegularTextRun run, int index) {
79
        int startIndex = currentPosition;
80
        int endIndex = currentPosition + run.getT()
81 2 1. addRun : Replaced integer subtraction with addition → KILLED
2. addRun : Replaced integer addition with subtraction → KILLED
                                            .length() - 1;
82
        runs.add(new PowerpointRun(startIndex, endIndex, index, run));
83 1 1. addRun : Replaced integer addition with subtraction → SURVIVED
        currentPosition = endIndex + 1;
84
    }
85
86
    private static CTTextCharacterProperties apply(
87
            CTTextCharacterProperties source,
88
            CTTextCharacterProperties destination
89
    ) {
90 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getAltLang()).ifPresent(destination::setAltLang);
91 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getBaseline()).ifPresent(destination::setBaseline);
92 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getBmk()).ifPresent(destination::setBmk);
93 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getBlipFill()).ifPresent(destination::setBlipFill);
94 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getCap()).ifPresent(destination::setCap);
95 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getCs()).ifPresent(destination::setCs);
96 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getGradFill()).ifPresent(destination::setGradFill);
97 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getGrpFill()).ifPresent(destination::setGrpFill);
98 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getHighlight()).ifPresent(destination::setHighlight);
99 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getHlinkClick()).ifPresent(destination::setHlinkClick);
100 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getHlinkMouseOver()).ifPresent(destination::setHlinkMouseOver);
101 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getKern()).ifPresent(destination::setKern);
102 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getLang()).ifPresent(destination::setLang);
103 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getLn()).ifPresent(destination::setLn);
104 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getLatin()).ifPresent(destination::setLatin);
105 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getNoFill()).ifPresent(destination::setNoFill);
106 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getPattFill()).ifPresent(destination::setPattFill);
107 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getSpc()).ifPresent(destination::setSpc);
108 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getSym()).ifPresent(destination::setSym);
109 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getStrike()).ifPresent(destination::setStrike);
110 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getSz()).ifPresent(destination::setSz);
111 1 1. apply : removed call to org/docx4j/dml/CTTextCharacterProperties::setSmtId → NO_COVERAGE
        destination.setSmtId(source.getSmtId());
112 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getU()).ifPresent(destination::setU);
113 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getUFill()).ifPresent(destination::setUFill);
114 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getUFillTx()).ifPresent(destination::setUFillTx);
115 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getULn()).ifPresent(destination::setULn);
116 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getULnTx()).ifPresent(destination::setULnTx);
117 1 1. apply : removed call to java/util/Optional::ifPresent → NO_COVERAGE
        ofNullable(source.getULnTx()).ifPresent(destination::setULnTx);
118 1 1. apply : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE
        return destination;
119
    }
120
121
    @Override
122
    public ProcessorContext processorContext(Placeholder placeholder) {
123
        var comment = comment(placeholder);
124
        var firstRun = (R) paragraph.getEGTextRun()
125
                                    .getFirst();
126 1 1. processorContext : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::processorContext → NO_COVERAGE
        return new ProcessorContext(this, firstRun, comment, placeholder);
127
    }
128
129
    @Override
130
    public void remove() {
131 1 1. remove : removed call to pro/verron/officestamper/utils/WmlUtils::remove → NO_COVERAGE
        WmlUtils.remove(getP());
132
    }
133
134
    @Override
135
    public void replace(List<P> toRemove, List<P> toAdd) {
136
        int index = siblings().indexOf(getP());
137 2 1. replace : negated conditional → NO_COVERAGE
2. replace : changed conditional boundary → NO_COVERAGE
        if (index < 0) throw new OfficeStamperException("Impossible");
138
139
        siblings().addAll(index, toAdd);
140
        siblings().removeAll(toRemove);
141
    }
142
143
    @Override
144
    public P getP() {
145
        var p = WmlFactory.newParagraph(paragraph.getEGTextRun());
146 1 1. getP : removed call to org/docx4j/wml/P::setParent → NO_COVERAGE
        p.setParent(paragraph.getParent());
147 1 1. getP : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::getP → NO_COVERAGE
        return p;
148
    }
149
150
    /**
151
     * Replaces the given expression with the replacement object within
152
     * the paragraph.
153
     * The replacement object must be a valid DOCX4J Object.
154
     *
155
     * @param placeholder the expression to be replaced.
156
     * @param replacement the object to replace the expression.
157
     */
158
    @Override
159
    public void replace(Placeholder placeholder, Object replacement) {
160 1 1. replace : negated conditional → KILLED
        if (!(replacement instanceof CTRegularTextRun replacementRun))
161
            throw new AssertionError("replacement is not a CTRegularTextRun");
162
        String text = asString();
163
        String full = placeholder.expression();
164
        int matchStartIndex = text.indexOf(full);
165 1 1. replace : negated conditional → KILLED
        if (matchStartIndex == -1) {
166
            // nothing to replace
167
            return;
168
        }
169 2 1. replace : Replaced integer subtraction with addition → SURVIVED
2. replace : Replaced integer addition with subtraction → KILLED
        int matchEndIndex = matchStartIndex + full.length() - 1;
170
        List<PowerpointRun> affectedRuns = getAffectedRuns(matchStartIndex, matchEndIndex);
171
172 1 1. replace : negated conditional → KILLED
        boolean singleRun = affectedRuns.size() == 1;
173
174
        List<Object> textRun = this.paragraph.getEGTextRun();
175 1 1. replace : removed call to org/docx4j/dml/CTRegularTextRun::setRPr → SURVIVED
        replacementRun.setRPr(affectedRuns.getFirst()
176
                                          .run()
177
                                          .getRPr());
178 2 1. replace : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::singleRun → NO_COVERAGE
2. replace : negated conditional → KILLED
        if (singleRun) singleRun(replacement,
179
                full,
180
                matchStartIndex,
181
                matchEndIndex,
182
                textRun,
183
                affectedRuns.getFirst(),
184
                affectedRuns.getLast());
185 1 1. replace : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::multipleRuns → KILLED
        else multipleRuns(replacement,
186
                affectedRuns,
187
                matchStartIndex,
188
                matchEndIndex,
189
                textRun,
190
                affectedRuns.getFirst(),
191
                affectedRuns.getLast());
192
193
    }
194
195
    private void singleRun(
196
            Object replacement,
197
            String full,
198
            int matchStartIndex,
199
            int matchEndIndex,
200
            List<Object> runs,
201
            PowerpointRun firstRun,
202
            PowerpointRun lastRun
203
    ) {
204
        assert firstRun == lastRun;
205
        boolean expressionSpansCompleteRun = full.length() == firstRun.run()
206
                                                                      .getT()
207 1 1. singleRun : negated conditional → NO_COVERAGE
                                                                      .length();
208 1 1. singleRun : negated conditional → NO_COVERAGE
        boolean expressionAtStartOfRun = matchStartIndex == firstRun.startIndex();
209 1 1. singleRun : negated conditional → NO_COVERAGE
        boolean expressionAtEndOfRun = matchEndIndex == firstRun.endIndex();
210 4 1. singleRun : changed conditional boundary → NO_COVERAGE
2. singleRun : negated conditional → NO_COVERAGE
3. singleRun : changed conditional boundary → NO_COVERAGE
4. singleRun : negated conditional → NO_COVERAGE
        boolean expressionWithinRun = matchStartIndex > firstRun.startIndex() && matchEndIndex < firstRun.endIndex();
211
212
213 1 1. singleRun : negated conditional → NO_COVERAGE
        if (expressionSpansCompleteRun) {
214
            runs.remove(firstRun.run());
215 1 1. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent(), replacement);
216 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE
            recalculateRuns();
217
        }
218 1 1. singleRun : negated conditional → NO_COVERAGE
        else if (expressionAtStartOfRun) {
219 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → NO_COVERAGE
            firstRun.replace(matchStartIndex, matchEndIndex, "");
220 1 1. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent(), replacement);
221 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE
            recalculateRuns();
222
        }
223 1 1. singleRun : negated conditional → NO_COVERAGE
        else if (expressionAtEndOfRun) {
224 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → NO_COVERAGE
            firstRun.replace(matchStartIndex, matchEndIndex, "");
225 2 1. singleRun : Replaced integer addition with subtraction → NO_COVERAGE
2. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent() + 1, replacement);
226 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE
            recalculateRuns();
227
        }
228 1 1. singleRun : negated conditional → NO_COVERAGE
        else if (expressionWithinRun) {
229
            String runText = firstRun.run()
230
                                     .getT();
231
            int startIndex = runText.indexOf(full);
232 1 1. singleRun : Replaced integer addition with subtraction → NO_COVERAGE
            int endIndex = startIndex + full.length();
233
            String substring1 = runText.substring(0, startIndex);
234
            CTRegularTextRun run1 = create(substring1, this.paragraph);
235
            String substring2 = runText.substring(endIndex);
236
            CTRegularTextRun run2 = create(substring2, this.paragraph);
237 1 1. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent(), run2);
238 1 1. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent(), replacement);
239 1 1. singleRun : removed call to java/util/List::add → NO_COVERAGE
            runs.add(firstRun.indexInParent(), run1);
240
            runs.remove(firstRun.run());
241 1 1. singleRun : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE
            recalculateRuns();
242
        }
243
    }
244
245
    private void multipleRuns(
246
            Object replacement,
247
            List<PowerpointRun> affectedRuns,
248
            int matchStartIndex,
249
            int matchEndIndex,
250
            List<Object> runs,
251
            PowerpointRun firstRun,
252
            PowerpointRun lastRun
253
    ) {
254
        // remove the expression from first and last run
255 1 1. multipleRuns : removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → KILLED
        firstRun.replace(matchStartIndex, matchEndIndex, "");
256 1 1. multipleRuns : removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → KILLED
        lastRun.replace(matchStartIndex, matchEndIndex, "");
257
258
        // remove all runs between first and last
259
        for (PowerpointRun run : affectedRuns) {
260 2 1. multipleRuns : negated conditional → KILLED
2. multipleRuns : negated conditional → KILLED
            if (!Objects.equals(run, firstRun) && !Objects.equals(run, lastRun)) {
261
                runs.remove(run.run());
262
            }
263
        }
264
265
        // add replacement run between first and last run
266 2 1. multipleRuns : Replaced integer addition with subtraction → KILLED
2. multipleRuns : removed call to java/util/List::add → KILLED
        runs.add(firstRun.indexInParent() + 1, replacement);
267
268 1 1. multipleRuns : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → SURVIVED
        recalculateRuns();
269
    }
270
271
    private static CTRegularTextRun create(String text, CTTextParagraph parentParagraph) {
272
        CTRegularTextRun run = new CTRegularTextRun();
273 1 1. create : removed call to org/docx4j/dml/CTRegularTextRun::setT → NO_COVERAGE
        run.setT(text);
274 1 1. create : removed call to pro/verron/officestamper/experimental/PowerpointParagraph::applyParagraphStyle → NO_COVERAGE
        applyParagraphStyle(parentParagraph, run);
275 1 1. create : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::create → NO_COVERAGE
        return run;
276
    }
277
278
    private static void applyParagraphStyle(CTTextParagraph p, CTRegularTextRun run) {
279
        var properties = p.getPPr();
280 1 1. applyParagraphStyle : negated conditional → NO_COVERAGE
        if (properties == null) return;
281
282
        var textCharacterProperties = properties.getDefRPr();
283 1 1. applyParagraphStyle : negated conditional → NO_COVERAGE
        if (textCharacterProperties == null) return;
284
285 1 1. applyParagraphStyle : removed call to org/docx4j/dml/CTRegularTextRun::setRPr → NO_COVERAGE
        run.setRPr(apply(textCharacterProperties));
286
    }
287
288
    /**
289
     * Returns the aggregated text over all runs.
290
     *
291
     * @return the text of all runs.
292
     */
293
    @Override
294
    public String asString() {
295 1 1. asString : replaced return value with "" for pro/verron/officestamper/experimental/PowerpointParagraph::asString → KILLED
        return runs.stream()
296
                   .map(PowerpointRun::run)
297
                   .map(CTRegularTextRun::getT)
298
                   .collect(joining()) + "\n";
299
    }
300
301
    @Override
302
    public void apply(Consumer<P> pConsumer) {
303 1 1. apply : removed call to java/util/function/Consumer::accept → NO_COVERAGE
        pConsumer.accept(getP());
304
    }
305
306
    @Override
307
    public Collection<Comments.Comment> getComment() {
308 1 1. getComment : replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::getComment → NO_COVERAGE
        return CommentUtil.getCommentFor(paragraph.getEGTextRun(), source.document());
309
    }
310
311
    private List<PowerpointRun> getAffectedRuns(int startIndex, int endIndex) {
312 1 1. getAffectedRuns : replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::getAffectedRuns → KILLED
        return runs.stream()
313 2 1. lambda$getAffectedRuns$0 : replaced boolean return with true for pro/verron/officestamper/experimental/PowerpointParagraph::lambda$getAffectedRuns$0 → SURVIVED
2. lambda$getAffectedRuns$0 : replaced boolean return with false for pro/verron/officestamper/experimental/PowerpointParagraph::lambda$getAffectedRuns$0 → KILLED
                   .filter(run -> run.isTouchedByRange(startIndex, endIndex))
314
                   .toList();
315
    }
316
317
    @Override
318
    public <T> Optional<T> parent(Class<T> aClass) {
319 1 1. parent : replaced return value with Optional.empty for pro/verron/officestamper/experimental/PowerpointParagraph::parent → NO_COVERAGE
        return parent(aClass, Integer.MAX_VALUE);
320
    }
321
322
    private List<Object> siblings() {
323 1 1. siblings : replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::siblings → NO_COVERAGE
        return this.parent(ContentAccessor.class, 1)
324
                   .orElseThrow(throwing("Not a standard Child with common parent"))
325
                   .getContent();
326
    }
327
328
    private static CTTextCharacterProperties apply(
329
            CTTextCharacterProperties source
330
    ) {
331 1 1. apply : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE
        return apply(source, new CTTextCharacterProperties());
332
    }
333
334
    private <T> Optional<T> parent(Class<T> aClass, int depth) {
335 1 1. parent : replaced return value with Optional.empty for pro/verron/officestamper/experimental/PowerpointParagraph::parent → NO_COVERAGE
        return WmlUtils.getFirstParentWithClass(getP(), aClass, depth);
336
    }
337
338
    private Comment comment(Placeholder placeholder) {
339
        var parent = getP();
340
        var id = new BigInteger(16, RANDOM);
341 1 1. comment : replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::comment → NO_COVERAGE
        return StandardComment.create(source.document(), parent, placeholder, id);
342
    }
343
344
    /**
345
     * {@inheritDoc}
346
     */
347
    @Override
348
    public String toString() {
349 1 1. toString : replaced return value with "" for pro/verron/officestamper/experimental/PowerpointParagraph::toString → NO_COVERAGE
        return asString();
350
    }
351
}

Mutations

53

1.1
Location : <init>
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → KILLED

62

1.1
Location : recalculateRuns
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

65

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

66

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

67

1.1
Location : recalculateRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::addRun → KILLED

69

1.1
Location : recalculateRuns
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

81

1.1
Location : addRun
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
Replaced integer subtraction with addition → KILLED

2.2
Location : addRun
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
Replaced integer addition with subtraction → KILLED

83

1.1
Location : addRun
Killed by : none
Replaced integer addition with subtraction → SURVIVED
Covering tests

90

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

91

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

92

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

93

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

94

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

95

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

96

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

97

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

98

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

99

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

100

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

101

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

102

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

103

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

104

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

105

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

106

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

107

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

108

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

109

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

110

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

111

1.1
Location : apply
Killed by : none
removed call to org/docx4j/dml/CTTextCharacterProperties::setSmtId → NO_COVERAGE

112

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

113

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

114

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

115

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

116

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

117

1.1
Location : apply
Killed by : none
removed call to java/util/Optional::ifPresent → NO_COVERAGE

118

1.1
Location : apply
Killed by : none
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE

126

1.1
Location : processorContext
Killed by : none
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::processorContext → NO_COVERAGE

131

1.1
Location : remove
Killed by : none
removed call to pro/verron/officestamper/utils/WmlUtils::remove → NO_COVERAGE

137

1.1
Location : replace
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : replace
Killed by : none
changed conditional boundary → NO_COVERAGE

146

1.1
Location : getP
Killed by : none
removed call to org/docx4j/wml/P::setParent → NO_COVERAGE

147

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

160

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

165

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

169

1.1
Location : replace
Killed by : none
Replaced integer subtraction with addition → SURVIVED
Covering tests

2.2
Location : replace
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
Replaced integer addition with subtraction → KILLED

172

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

175

1.1
Location : replace
Killed by : none
removed call to org/docx4j/dml/CTRegularTextRun::setRPr → SURVIVED
Covering tests

178

1.1
Location : replace
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::singleRun → NO_COVERAGE

2.2
Location : replace
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
negated conditional → KILLED

185

1.1
Location : replace
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::multipleRuns → KILLED

207

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

208

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

209

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

210

1.1
Location : singleRun
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : singleRun
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

213

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

215

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

216

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE

218

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

219

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → NO_COVERAGE

220

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

221

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE

223

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

224

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → NO_COVERAGE

225

1.1
Location : singleRun
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : singleRun
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

226

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE

228

1.1
Location : singleRun
Killed by : none
negated conditional → NO_COVERAGE

232

1.1
Location : singleRun
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

237

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

238

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

239

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

241

1.1
Location : singleRun
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → NO_COVERAGE

255

1.1
Location : multipleRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → KILLED

256

1.1
Location : multipleRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointRun::replace → KILLED

260

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

2.2
Location : multipleRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
negated conditional → KILLED

266

1.1
Location : multipleRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
Replaced integer addition with subtraction → KILLED

2.2
Location : multipleRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to java/util/List::add → KILLED

268

1.1
Location : multipleRuns
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::recalculateRuns → SURVIVED
Covering tests

273

1.1
Location : create
Killed by : none
removed call to org/docx4j/dml/CTRegularTextRun::setT → NO_COVERAGE

274

1.1
Location : create
Killed by : none
removed call to pro/verron/officestamper/experimental/PowerpointParagraph::applyParagraphStyle → NO_COVERAGE

275

1.1
Location : create
Killed by : none
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::create → NO_COVERAGE

280

1.1
Location : applyParagraphStyle
Killed by : none
negated conditional → NO_COVERAGE

283

1.1
Location : applyParagraphStyle
Killed by : none
negated conditional → NO_COVERAGE

285

1.1
Location : applyParagraphStyle
Killed by : none
removed call to org/docx4j/dml/CTRegularTextRun::setRPr → NO_COVERAGE

295

1.1
Location : asString
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with "" for pro/verron/officestamper/experimental/PowerpointParagraph::asString → KILLED

303

1.1
Location : apply
Killed by : none
removed call to java/util/function/Consumer::accept → NO_COVERAGE

308

1.1
Location : getComment
Killed by : none
replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::getComment → NO_COVERAGE

312

1.1
Location : getAffectedRuns
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::getAffectedRuns → KILLED

313

1.1
Location : lambda$getAffectedRuns$0
Killed by : none
replaced boolean return with true for pro/verron/officestamper/experimental/PowerpointParagraph::lambda$getAffectedRuns$0 → SURVIVED
Covering tests

2.2
Location : lambda$getAffectedRuns$0
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced boolean return with false for pro/verron/officestamper/experimental/PowerpointParagraph::lambda$getAffectedRuns$0 → KILLED

319

1.1
Location : parent
Killed by : none
replaced return value with Optional.empty for pro/verron/officestamper/experimental/PowerpointParagraph::parent → NO_COVERAGE

323

1.1
Location : siblings
Killed by : none
replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointParagraph::siblings → NO_COVERAGE

331

1.1
Location : apply
Killed by : none
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE

335

1.1
Location : parent
Killed by : none
replaced return value with Optional.empty for pro/verron/officestamper/experimental/PowerpointParagraph::parent → NO_COVERAGE

341

1.1
Location : comment
Killed by : none
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::comment → NO_COVERAGE

349

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

Active mutators

Tests examined


Report generated by PIT 1.20.0