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

Mutations

51

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

58

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

61

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

62

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

63

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

65

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

75

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

77

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

84

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

85

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

86

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

87

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

88

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

89

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

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 org/docx4j/dml/CTTextCharacterProperties::setSmtId → 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 java/util/Optional::ifPresent → NO_COVERAGE

112

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

120

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

125

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

131

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

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

140

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

141

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

152

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

157

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

161

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

164

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

167

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

170

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

177

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

199

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

200

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

201

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

202

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

205

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

207

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

208

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

210

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

211

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

212

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

213

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

215

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

216

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

217

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

218

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

220

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

224

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

229

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

230

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

231

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

233

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

247

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

248

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

252

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

258

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

260

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

265

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

266

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

267

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

272

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

275

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

277

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

285

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

293

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

298

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

307

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

308

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

314

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

318

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

326

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

330

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

336

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

342

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.21.0