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

Mutations

48

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

55

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

58

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

59

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

60

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

62

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

72

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

74

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

81

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

82

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

83

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

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 org/docx4j/dml/CTTextCharacterProperties::setSmtId → 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
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE

114

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

115

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

116

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

121

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

124

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

126

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

132

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

138

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 : remove
Killed by : none
removed call to pro/verron/officestamper/utils/wml/WmlUtils::remove → NO_COVERAGE

155

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

163

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

170

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

173

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

176

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

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

183

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

203

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

211

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

216

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

221

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

235

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

241

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

256

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

257

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

258

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

259

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

262

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

264

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

265

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

267

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

268

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

269

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

270

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

272

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

273

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

274

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

275

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

277

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

281

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

286

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

287

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

288

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

290

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

304

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

305

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

309

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

315

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

317

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

321

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

322

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

329

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.25.5 support