RepeatDocPartProcessor.java

1
package pro.verron.officestamper.preset.processors.repeatdocpart;
2
3
import org.docx4j.openpackaging.exceptions.Docx4JException;
4
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
5
import org.docx4j.wml.ContentAccessor;
6
import org.docx4j.wml.P;
7
import org.docx4j.wml.R;
8
import org.docx4j.wml.SectPr;
9
import org.jvnet.jaxb2_commons.ppp.Child;
10
import org.springframework.lang.Nullable;
11
import pro.verron.officestamper.api.*;
12
import pro.verron.officestamper.core.CommentUtil;
13
import pro.verron.officestamper.core.DocumentUtil;
14
import pro.verron.officestamper.core.SectionUtil;
15
import pro.verron.officestamper.preset.CommentProcessorFactory;
16
import pro.verron.officestamper.utils.WmlFactory;
17
18
import java.io.IOException;
19
import java.io.OutputStream;
20
import java.io.PipedInputStream;
21
import java.io.PipedOutputStream;
22
import java.util.*;
23
import java.util.concurrent.CopyOnWriteArrayList;
24
import java.util.concurrent.Executors;
25
import java.util.concurrent.ThreadFactory;
26
import java.util.concurrent.atomic.AtomicReference;
27
import java.util.function.Consumer;
28
import java.util.function.Supplier;
29
import java.util.function.UnaryOperator;
30
31
import static java.util.Objects.requireNonNull;
32
import static java.util.stream.Collectors.toMap;
33
import static pro.verron.officestamper.core.DocumentUtil.walkObjectsAndImportImages;
34
import static pro.verron.officestamper.core.SectionUtil.getPreviousSectionBreakIfPresent;
35
36
/// This class is responsible for processing the <ds: repeat> tag.
37
/// It uses the [OfficeStamper] to stamp the sub document and then
38
/// copies the resulting sub document to the correct position in the
39
/// main document.
40
///
41
/// @author Joseph Verron
42
/// @author Youssouf Naciri
43
/// @version ${version}
44
/// @since 1.3.0
45
public class RepeatDocPartProcessor
46
        extends AbstractCommentProcessor
47
        implements CommentProcessorFactory.IRepeatDocPartProcessor {
48
    private static final ThreadFactory threadFactory = Executors.defaultThreadFactory();
49
50
    private final OfficeStamper<WordprocessingMLPackage> stamper;
51
    private final Map<Comment, Iterable<Object>> contexts = new HashMap<>();
52
    private final Supplier<? extends List<?>> nullSupplier;
53
54
    private RepeatDocPartProcessor(
55
            ParagraphPlaceholderReplacer placeholderReplacer,
56
            OfficeStamper<WordprocessingMLPackage> stamper,
57
            Supplier<? extends List<?>> nullSupplier
58
    ) {
59
        super(placeholderReplacer);
60
        this.stamper = stamper;
61
        this.nullSupplier = nullSupplier;
62
    }
63
64
    /// newInstance.
65
    ///
66
    /// @param pr      the placeholderReplacer
67
    /// @param stamper the stamper
68
    ///
69
    /// @return a new instance of this processor
70
    public static CommentProcessor newInstance(
71
            ParagraphPlaceholderReplacer pr, OfficeStamper<WordprocessingMLPackage> stamper
72
    ) {
73 1 1. newInstance : replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::newInstance → KILLED
        return new RepeatDocPartProcessor(pr, stamper, Collections::emptyList);
74
    }
75
76
    /// {@inheritDoc}
77
    @Override public void repeatDocPart(@Nullable Iterable<Object> contexts) {
78 1 1. repeatDocPart : negated conditional → KILLED
        if (contexts == null) contexts = Collections.emptyList();
79
80
        Comment currentComment = getCurrentCommentWrapper();
81
        List<Object> elements = currentComment.getElements();
82
83 1 1. repeatDocPart : negated conditional → KILLED
        if (!elements.isEmpty()) {
84
            this.contexts.put(currentComment, contexts);
85
        }
86
    }
87
88
    /// {@inheritDoc}
89
    @Override public void commitChanges(DocxPart source) {
90
        for (Map.Entry<Comment, Iterable<Object>> entry : this.contexts.entrySet()) {
91
            var comment = entry.getKey();
92
            var expressionContexts = entry.getValue();
93
            var gcp = requireNonNull(comment.getParent());
94
            var repeatElements = comment.getElements();
95
            var subTemplate = CommentUtil.createSubWordDocument(comment);
96
            var oddNumberOfBreaks = SectionUtil.hasOddNumberOfSectionBreaks(repeatElements);
97
            var sectionBreakInserter = getPreviousSectionBreakIfPresent(repeatElements.getFirst(), gcp)
98 2 1. lambda$commitChanges$0 : replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$commitChanges$0 → KILLED
2. lambda$commitChanges$1 : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$commitChanges$1 → KILLED
                    .map(psb -> (UnaryOperator<List<Object>>) objs -> insertSectionBreak(objs, psb, oddNumberOfBreaks))
99
                    .orElse(UnaryOperator.identity());
100 1 1. commitChanges : negated conditional → KILLED
            var changes = expressionContexts == null
101
                    ? nullSupplier.get()
102
                    : stampSubDocuments(source.document(), expressionContexts, gcp, subTemplate, sectionBreakInserter);
103
            var gcpContent = gcp.getContent();
104
            var index = gcpContent.indexOf(repeatElements.getFirst());
105
            gcpContent.addAll(index, changes);
106
            gcpContent.removeAll(repeatElements);
107
        }
108
    }
109
110
    private static List<Object> insertSectionBreak(
111
            List<Object> elements, SectPr previousSectionBreak, boolean oddNumberOfBreaks
112
    ) {
113
        var inserts = new ArrayList<>(elements);
114 1 1. insertSectionBreak : negated conditional → KILLED
        if (oddNumberOfBreaks) {
115 1 1. insertSectionBreak : negated conditional → KILLED
            if (inserts.getLast() instanceof P p) {
116 1 1. insertSectionBreak : removed call to pro/verron/officestamper/core/SectionUtil::applySectionBreakToParagraph → KILLED
                SectionUtil.applySectionBreakToParagraph(previousSectionBreak, p);
117
            }
118
            else {
119
                // when the last repeated element is not a paragraph,
120
                // it is necessary to add one carrying the section break.
121
                P p = WmlFactory.newParagraph(List.of());
122 1 1. insertSectionBreak : removed call to pro/verron/officestamper/core/SectionUtil::applySectionBreakToParagraph → KILLED
                SectionUtil.applySectionBreakToParagraph(previousSectionBreak, p);
123
                inserts.add(p);
124
            }
125
        }
126 1 1. insertSectionBreak : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::insertSectionBreak → KILLED
        return inserts;
127
    }
128
129
    private List<Object> stampSubDocuments(
130
            WordprocessingMLPackage document,
131
            Iterable<Object> expressionContexts,
132
            ContentAccessor gcp,
133
            WordprocessingMLPackage subTemplate,
134
            UnaryOperator<List<Object>> sectionBreakInserter
135
    ) {
136
        var subDocuments = stampSubDocuments(expressionContexts, subTemplate);
137
        var replacements = subDocuments.stream()
138
                                       //TODO: move side effect somewhere else
139 1 1. lambda$stampSubDocuments$0 : replaced return value with Collections.emptyMap for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$stampSubDocuments$0 → KILLED
                                       .map(p -> walkObjectsAndImportImages(p, document))
140
                                       .map(Map::entrySet)
141
                                       .flatMap(Set::stream)
142
                                       .collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
143
144
        var changes = new ArrayList<>();
145
        for (WordprocessingMLPackage subDocument : subDocuments) {
146
            var os = sectionBreakInserter.apply(DocumentUtil.allElements(subDocument));
147
            os.stream()
148
              .filter(ContentAccessor.class::isInstance)
149
              .map(ContentAccessor.class::cast)
150 2 1. lambda$stampSubDocuments$1 : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::recursivelyReplaceImages → KILLED
2. stampSubDocuments : removed call to java/util/stream/Stream::forEach → KILLED
              .forEach(o -> recursivelyReplaceImages(o, replacements));
151 2 1. lambda$stampSubDocuments$2 : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::setParentIfPossible → SURVIVED
2. stampSubDocuments : removed call to java/util/List::forEach → SURVIVED
            os.forEach(c -> setParentIfPossible(c, gcp));
152
            changes.addAll(os);
153
        }
154 1 1. stampSubDocuments : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stampSubDocuments → KILLED
        return changes;
155
    }
156
157
    private List<WordprocessingMLPackage> stampSubDocuments(
158
            Iterable<Object> subContexts, WordprocessingMLPackage subTemplate
159
    ) {
160
        var subDocuments = new ArrayList<WordprocessingMLPackage>();
161
        for (Object subContext : subContexts) {
162 1 1. lambda$stampSubDocuments$3 : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::copy → TIMED_OUT
            var templateCopy = outputWord(os -> copy(subTemplate, os));
163 1 1. lambda$stampSubDocuments$4 : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stamp → TIMED_OUT
            var subDocument = outputWord(os -> stamp(subContext, templateCopy, os));
164
            subDocuments.add(subDocument);
165
        }
166 1 1. stampSubDocuments : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stampSubDocuments → KILLED
        return subDocuments;
167
    }
168
169
    private static void recursivelyReplaceImages(
170
            ContentAccessor r, Map<R, R> replacements
171
    ) {
172
        Queue<ContentAccessor> q = new ArrayDeque<>();
173
        q.add(r);
174 1 1. recursivelyReplaceImages : negated conditional → KILLED
        while (!q.isEmpty()) {
175
            ContentAccessor run = q.remove();
176 2 1. recursivelyReplaceImages : negated conditional → KILLED
2. recursivelyReplaceImages : negated conditional → KILLED
            if (replacements.containsKey(run) && run instanceof Child child
177 1 1. recursivelyReplaceImages : negated conditional → KILLED
                && child.getParent() instanceof ContentAccessor parent) {
178
                List<Object> parentContent = parent.getContent();
179 1 1. recursivelyReplaceImages : removed call to java/util/List::add → KILLED
                parentContent.add(parentContent.indexOf(run), replacements.get(run));
180
                parentContent.remove(run);
181
            }
182
            else {
183
                q.addAll(run.getContent()
184
                            .stream()
185
                            .filter(ContentAccessor.class::isInstance)
186
                            .map(ContentAccessor.class::cast)
187
                            .toList());
188
            }
189
        }
190
    }
191
192
    private static void setParentIfPossible(
193
            Object object, ContentAccessor parent
194
    ) {
195 2 1. setParentIfPossible : removed call to org/jvnet/jaxb2_commons/ppp/Child::setParent → SURVIVED
2. setParentIfPossible : negated conditional → KILLED
        if (object instanceof Child child) child.setParent(parent);
196
    }
197
198
    private WordprocessingMLPackage outputWord(Consumer<OutputStream> outputter) {
199
        var exceptionHandler = new ProcessorExceptionHandler();
200
        try (var os = new PipedOutputStream(); var is = new PipedInputStream(os)) {
201
            // closing on exception to not block the pipe infinitely
202
            // TODO: model both PipedxxxStream as 1 class for only 1 close()
203 1 1. outputWord : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::onException → SURVIVED
            exceptionHandler.onException(is::close); // I know it's redundant,
204 1 1. outputWord : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::onException → TIMED_OUT
            exceptionHandler.onException(os::close); // but symmetry
205
206 1 1. lambda$outputWord$0 : removed call to java/util/function/Consumer::accept → TIMED_OUT
            var thread = threadFactory.newThread(() -> outputter.accept(os));
207 1 1. outputWord : removed call to java/lang/Thread::setUncaughtExceptionHandler → TIMED_OUT
            thread.setUncaughtExceptionHandler(exceptionHandler);
208 1 1. outputWord : removed call to java/lang/Thread::start → TIMED_OUT
            thread.start();
209
            var wordprocessingMLPackage = WordprocessingMLPackage.load(is);
210 1 1. outputWord : removed call to java/lang/Thread::join → SURVIVED
            thread.join();
211 1 1. outputWord : replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::outputWord → KILLED
            return wordprocessingMLPackage;
212
        } catch (Docx4JException | IOException e) {
213
            OfficeStamperException exception = new OfficeStamperException(e);
214
            exceptionHandler.exception()
215 1 1. outputWord : removed call to java/util/Optional::ifPresent → KILLED
                            .ifPresent(exception::addSuppressed);
216
            throw exception;
217
        } catch (InterruptedException e) {
218
            OfficeStamperException exception = new OfficeStamperException(e);
219
            exceptionHandler.exception()
220 1 1. outputWord : removed call to java/util/Optional::ifPresent → NO_COVERAGE
                            .ifPresent(e::addSuppressed);
221
            Thread.currentThread()
222 1 1. outputWord : removed call to java/lang/Thread::interrupt → NO_COVERAGE
                  .interrupt();
223
            throw exception;
224
        }
225
    }
226
227
    private void copy(
228
            WordprocessingMLPackage aPackage, OutputStream outputStream
229
    ) {
230
        try {
231 1 1. copy : removed call to org/docx4j/openpackaging/packages/WordprocessingMLPackage::save → TIMED_OUT
            aPackage.save(outputStream);
232
        } catch (Docx4JException e) {
233
            throw new OfficeStamperException(e);
234
        }
235
    }
236
237
    private void stamp(
238
            Object context, WordprocessingMLPackage template, OutputStream outputStream
239
    ) {
240 1 1. stamp : removed call to pro/verron/officestamper/api/OfficeStamper::stamp → TIMED_OUT
        stamper.stamp(template, context, outputStream);
241
    }
242
243
    /// {@inheritDoc}
244
    @Override public void reset() {
245 1 1. reset : removed call to java/util/Map::clear → SURVIVED
        contexts.clear();
246
    }
247
248
    /// A functional interface representing runnable task able to throw an exception.
249
    /// It extends the [Runnable] interface and provides default implementation
250
    /// of the [Runnable#run()] method handling the exception by rethrowing it
251
    /// wrapped inside a [OfficeStamperException].
252
    ///
253
    /// @author Joseph Verron
254
    /// @version ${version}
255
    /// @since 1.6.6
256
    interface ThrowingRunnable
257
            extends Runnable {
258
259
        /// Executes the runnable task, handling any exception by throwing it wrapped
260
        /// inside a [OfficeStamperException].
261
        default void run() {
262
            try {
263 1 1. run : removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ThrowingRunnable::throwingRun → TIMED_OUT
                throwingRun();
264
            } catch (Exception e) {
265
                throw new OfficeStamperException(e);
266
            }
267
        }
268
269
        /// Executes the runnable task
270
        ///
271
        /// @throws Exception if an exception occurs executing the task
272
        void throwingRun()
273
                throws Exception;
274
    }
275
276
    /// This class is responsible for capturing and handling uncaught exceptions
277
    /// that occur in a thread.
278
    /// It implements the [Thread.UncaughtExceptionHandler] interface and can
279
    /// be assigned to a thread using the
280
    /// [Thread#setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler)] method.
281
    /// When an exception occurs in the thread,
282
    /// the [ProcessorExceptionHandler#uncaughtException(Thread, Throwable)]
283
    /// method will be called.
284
    /// This class provides the following features:
285
    /// 1. Capturing and storing the uncaught exception.
286
    /// 2. Executing a list of routines when an exception occurs.
287
    /// 3. Providing access to the captured exception, if any.
288
    /// Example usage:
289
    /// <code>
290
    /// ProcessorExceptionHandler exceptionHandler = new
291
    /// ProcessorExceptionHandler(){};
292
    /// thread.setUncaughtExceptionHandler(exceptionHandler);
293
    /// </code>
294
    ///
295
    /// @author Joseph Verron
296
    /// @version ${version}
297
    /// @see Thread.UncaughtExceptionHandler
298
    /// @since 1.6.6
299
    static class ProcessorExceptionHandler
300
            implements Thread.UncaughtExceptionHandler {
301
        private final AtomicReference<Throwable> exception;
302
        private final List<Runnable> onException;
303
304
        /// Constructs a new instance for managing thread's uncaught exceptions.
305
        /// Once set to a thread, it retains the exception information and performs specified routines.
306
        public ProcessorExceptionHandler() {
307
            this.exception = new AtomicReference<>();
308
            this.onException = new CopyOnWriteArrayList<>();
309
        }
310
311
        /// {@inheritDoc}
312
        ///
313
        /// Captures and stores an uncaught exception from a thread run
314
        /// and executes all defined routines on occurrence of the exception.
315
        @Override public void uncaughtException(Thread t, Throwable e) {
316 1 1. uncaughtException : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED
            exception.set(e);
317 1 1. uncaughtException : removed call to java/util/List::forEach → TIMED_OUT
            onException.forEach(Runnable::run);
318
        }
319
320
        /// Adds a routine to the list of routines that should be run
321
        /// when an exception occurs.
322
        ///
323
        /// @param runnable The runnable routine to be added
324
        public void onException(ThrowingRunnable runnable) {
325
            onException.add(runnable);
326
        }
327
328
        /// Returns the captured exception if present.
329
        ///
330
        /// @return an [Optional] containing the captured exception,
331
        /// or an [Optional#empty()] if no exception was captured
332
        public Optional<Throwable> exception() {
333 1 1. exception : replaced return value with Optional.empty for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::exception → KILLED
            return Optional.ofNullable(exception.get());
334
        }
335
    }
336
}

Mutations

73

1.1
Location : newInstance
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testStaticResolution(java.lang.String, boolean, boolean, boolean, java.lang.String, java.lang.String)]/[test-template-invocation:#6]
replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::newInstance → KILLED

78

1.1
Location : repeatDocPart
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
negated conditional → KILLED

83

1.1
Location : repeatDocPart
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
negated conditional → KILLED

98

1.1
Location : lambda$commitChanges$0
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$commitChanges$0 → KILLED

2.2
Location : lambda$commitChanges$1
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$commitChanges$1 → KILLED

100

1.1
Location : commitChanges
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
negated conditional → KILLED

114

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

115

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

116

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

122

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

126

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

139

1.1
Location : lambda$stampSubDocuments$0
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#10]
replaced return value with Collections.emptyMap for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::lambda$stampSubDocuments$0 → KILLED

150

1.1
Location : lambda$stampSubDocuments$1
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#10]
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::recursivelyReplaceImages → KILLED

2.2
Location : stampSubDocuments
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#10]
removed call to java/util/stream/Stream::forEach → KILLED

151

1.1
Location : lambda$stampSubDocuments$2
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::setParentIfPossible → SURVIVED
Covering tests

2.2
Location : stampSubDocuments
Killed by : none
removed call to java/util/List::forEach → SURVIVED Covering tests

154

1.1
Location : stampSubDocuments
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[test-template:test52(pro.verron.officestamper.test.RegressionTests$Conditions, java.lang.String)]/[test-template-invocation:#3]
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stampSubDocuments → KILLED

162

1.1
Location : lambda$stampSubDocuments$3
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::copy → TIMED_OUT

163

1.1
Location : lambda$stampSubDocuments$4
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stamp → TIMED_OUT

166

1.1
Location : stampSubDocuments
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[test-template:test52(pro.verron.officestamper.test.RegressionTests$Conditions, java.lang.String)]/[test-template-invocation:#3]
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::stampSubDocuments → KILLED

174

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

176

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

2.2
Location : recursivelyReplaceImages
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[test-template:test52(pro.verron.officestamper.test.RegressionTests$Conditions, java.lang.String)]/[test-template-invocation:#3]
negated conditional → KILLED

177

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

179

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

195

1.1
Location : setParentIfPossible
Killed by : none
removed call to org/jvnet/jaxb2_commons/ppp/Child::setParent → SURVIVED
Covering tests

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

203

1.1
Location : outputWord
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::onException → SURVIVED
Covering tests

204

1.1
Location : outputWord
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::onException → TIMED_OUT

206

1.1
Location : lambda$outputWord$0
Killed by : none
removed call to java/util/function/Consumer::accept → TIMED_OUT

207

1.1
Location : outputWord
Killed by : none
removed call to java/lang/Thread::setUncaughtExceptionHandler → TIMED_OUT

208

1.1
Location : outputWord
Killed by : none
removed call to java/lang/Thread::start → TIMED_OUT

210

1.1
Location : outputWord
Killed by : none
removed call to java/lang/Thread::join → SURVIVED
Covering tests

211

1.1
Location : outputWord
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
replaced return value with null for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor::outputWord → KILLED

215

1.1
Location : outputWord
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
removed call to java/util/Optional::ifPresent → KILLED

220

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

222

1.1
Location : outputWord
Killed by : none
removed call to java/lang/Thread::interrupt → NO_COVERAGE

231

1.1
Location : copy
Killed by : none
removed call to org/docx4j/openpackaging/packages/WordprocessingMLPackage::save → TIMED_OUT

240

1.1
Location : stamp
Killed by : none
removed call to pro/verron/officestamper/api/OfficeStamper::stamp → TIMED_OUT

245

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

263

1.1
Location : run
Killed by : none
removed call to pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ThrowingRunnable::throwingRun → TIMED_OUT

316

1.1
Location : uncaughtException
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED

317

1.1
Location : uncaughtException
Killed by : none
removed call to java/util/List::forEach → TIMED_OUT

333

1.1
Location : exception
Killed by : pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatDocPart_BadPlaceholderTest]/[test-template:testBadExpressionShouldNotBlockCallerThread(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
replaced return value with Optional.empty for pro/verron/officestamper/preset/processors/repeatdocpart/RepeatDocPartProcessor$ProcessorExceptionHandler::exception → KILLED

Active mutators

Tests examined


Report generated by PIT 1.21.0