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

Mutations

49

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

56

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

59

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

60

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

61

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

63

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

73

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

75

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

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 java/util/Optional::ifPresent → NO_COVERAGE

103

1.1
Location : apply
Killed by : none
removed call to org/docx4j/dml/CTTextCharacterProperties::setSmtId → 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
replaced return value with null for pro/verron/officestamper/experimental/PowerpointParagraph::apply → NO_COVERAGE

115

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

116

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

117

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

122

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

125

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

127

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

133

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

139

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

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

147

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

156

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

158

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

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

168

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

171

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

174

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

177

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

184

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

204

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

212

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

217

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

222

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

236

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

242

1.1
Location : parent
Killed by : none
replaced return value with Optional.empty for pro/verron/officestamper/experimental/PowerpointParagraph::parent → 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
negated conditional → NO_COVERAGE

260

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

263

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

265

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

266

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

268

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

269

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

270

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

271

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

273

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

274

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

275

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

276

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

278

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

282

1.1
Location : singleRun
Killed by : none
Replaced integer addition with subtraction → 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

289

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

291

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

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

306

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

310

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

316

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

318

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

322

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

323

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

330

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