DocumentUtil.java

1
package pro.verron.officestamper.core;
2
3
import jakarta.xml.bind.JAXBElement;
4
import org.docx4j.TraversalUtil;
5
import org.docx4j.XmlUtils;
6
import org.docx4j.finders.ClassFinder;
7
import org.docx4j.model.structure.HeaderFooterPolicy;
8
import org.docx4j.model.structure.SectionWrapper;
9
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
10
import org.docx4j.openpackaging.parts.JaxbXmlPart;
11
import org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage;
12
import org.docx4j.utils.TraversalUtilVisitor;
13
import org.docx4j.wml.*;
14
import org.jvnet.jaxb2_commons.ppp.Child;
15
import org.slf4j.Logger;
16
import org.slf4j.LoggerFactory;
17
import org.springframework.lang.Nullable;
18
import org.springframework.util.function.ThrowingFunction;
19
import pro.verron.officestamper.api.DocxPart;
20
import pro.verron.officestamper.api.OfficeStamperException;
21
22
import java.util.*;
23
import java.util.stream.Stream;
24
25
import static java.util.Collections.emptyList;
26
import static java.util.Optional.ofNullable;
27
import static java.util.stream.Stream.Builder;
28
import static pro.verron.officestamper.utils.WmlFactory.newRun;
29
30
/**
31
 * Utility class to retrieve elements from a document.
32
 *
33
 * @author Joseph Verron
34
 * @author DallanMC
35
 * @version ${version}
36
 * @since 1.4.7
37
 */
38
public class DocumentUtil {
39
40
    private static final Logger log = LoggerFactory.getLogger(DocumentUtil.class);
41
42
    private DocumentUtil() {
43
        throw new OfficeStamperException("Utility classes shouldn't be instantiated");
44
    }
45
46
    /**
47
     * Streams the elements of a given class type from the specified DocxPart.
48
     *
49
     * @param <T>          the type of elements to be streamed
50
     * @param source       the source DocxPart containing the elements to be streamed
51
     * @param elementClass the class type of the elements to be filtered and streamed.
52
     *
53
     * @return a Stream of elements of the specified type found within the source DocxPart.
54
     */
55
    public static <T> Stream<T> streamObjectElements(DocxPart source, Class<T> elementClass) {
56
        ClassFinder finder = new ClassFinder(elementClass);
57 1 1. streamObjectElements : removed call to org/docx4j/TraversalUtil::visit → KILLED
        TraversalUtil.visit(source.part(), finder);
58 1 1. streamObjectElements : replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::streamObjectElements → KILLED
        return finder.results.stream()
59
                             .map(elementClass::cast);
60
    }
61
62
    /**
63
     * Retrieves all elements from the main document part of the specified WordprocessingMLPackage.
64
     *
65
     * @param subDocument the WordprocessingMLPackage from which to retrieve the elements
66
     * @return a list of objects representing the content of the main document part.
67
     */
68
    public static List<Object> allElements(WordprocessingMLPackage subDocument) {
69 1 1. allElements : replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocumentUtil::allElements → KILLED
        return subDocument.getMainDocumentPart()
70
                          .getContent();
71
    }
72
73
    /**
74
     * Recursively walk through a source to find embedded images and import them in the target document.
75
     *
76
     * @param source source document containing image files.
77
     * @param target target document to add image files to.
78
     *
79
     * @return a {@link Map} object
80
     */
81
    public static Map<R, R> walkObjectsAndImportImages(WordprocessingMLPackage source, WordprocessingMLPackage target) {
82 1 1. walkObjectsAndImportImages : replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocumentUtil::walkObjectsAndImportImages → KILLED
        return walkObjectsAndImportImages(source.getMainDocumentPart(), source, target);
83
    }
84
85
    /**
86
     * Recursively walk through source accessor to find embedded images and import the target document.
87
     *
88
     * @param container source container to walk.
89
     * @param source    source document containing image files.
90
     * @param target    target document to add image files to.
91
     *
92
     * @return a {@link Map} object
93
     */
94
    public static Map<R, R> walkObjectsAndImportImages(
95
            ContentAccessor container,
96
            WordprocessingMLPackage source,
97
            WordprocessingMLPackage target
98
    ) {
99
        Map<R, R> replacements = new HashMap<>();
100
        for (Object obj : container.getContent()) {
101
            Queue<Object> queue = new ArrayDeque<>();
102
            queue.add(obj);
103
104 1 1. walkObjectsAndImportImages : negated conditional → KILLED
            while (!queue.isEmpty()) {
105
                Object currentObj = queue.remove();
106
107 2 1. walkObjectsAndImportImages : negated conditional → KILLED
2. walkObjectsAndImportImages : negated conditional → KILLED
                if (currentObj instanceof R currentR && containsImage(currentR)) {
108
                    var docxImageExtractor = new DocxImageExtractor(source);
109
                    var imageData = docxImageExtractor.getRunDrawingData(currentR);
110
                    var maxWidth = docxImageExtractor.getRunDrawingMaxWidth(currentR);
111
                    var imagePart = tryCreateImagePart(target, imageData);
112
                    var runWithImage = newRun(maxWidth, imagePart, "dummyFileName", "dummyAltText");
113
                    replacements.put(currentR, runWithImage);
114
                }
115 1 1. walkObjectsAndImportImages : negated conditional → KILLED
                else if (currentObj instanceof ContentAccessor contentAccessor)
116
                    queue.addAll(contentAccessor.getContent());
117
            }
118
        }
119 1 1. walkObjectsAndImportImages : replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocumentUtil::walkObjectsAndImportImages → KILLED
        return replacements;
120
    }
121
122
    private static boolean containsImage(R run) {
123 2 1. containsImage : replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::containsImage → KILLED
2. containsImage : replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::containsImage → KILLED
        return run.getContent()
124
                  .stream()
125
                  .filter(JAXBElement.class::isInstance)
126
                  .map(JAXBElement.class::cast)
127
                  .map(JAXBElement::getValue)
128
                  .anyMatch(Drawing.class::isInstance);
129
    }
130
131
    private static BinaryPartAbstractImage tryCreateImagePart(WordprocessingMLPackage destDocument, byte[] imageData) {
132
        try {
133 1 1. tryCreateImagePart : replaced return value with null for pro/verron/officestamper/core/DocumentUtil::tryCreateImagePart → KILLED
            return BinaryPartAbstractImage.createImagePart(destDocument, imageData);
134
        } catch (Exception e) {
135
            throw new OfficeStamperException(e);
136
        }
137
    }
138
139
    /**
140
     * Finds the smallest common parent between two objects.
141
     *
142
     * @param o1 the first object
143
     * @param o2 the second object
144
     *
145
     * @return the smallest common parent of the two objects
146
     *
147
     * @throws OfficeStamperException if there is an error finding the common parent
148
     */
149
    public static ContentAccessor findSmallestCommonParent(Object o1, Object o2) {
150 2 1. findSmallestCommonParent : negated conditional → KILLED
2. findSmallestCommonParent : negated conditional → KILLED
        if (depthElementSearch(o1, o2) && o2 instanceof ContentAccessor contentAccessor)
151 1 1. findSmallestCommonParent : replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findSmallestCommonParent → KILLED
            return findInsertableParent(contentAccessor);
152 2 1. findSmallestCommonParent : negated conditional → KILLED
2. findSmallestCommonParent : replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findSmallestCommonParent → KILLED
        else if (o2 instanceof Child child) return findSmallestCommonParent(o1, child.getParent());
153
        else throw new OfficeStamperException();
154
    }
155
156
    /**
157
     * Recursively searches for an element in a content tree.
158
     *
159
     * @param searchTarget the element to search for
160
     * @param searchTree   the content tree to search in
161
     *
162
     * @return true if the element is found, false otherwise
163
     */
164
    public static boolean depthElementSearch(Object searchTarget, Object searchTree) {
165
        var element = XmlUtils.unwrap(searchTree);
166 2 1. depthElementSearch : replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED
2. depthElementSearch : negated conditional → KILLED
        if (searchTarget.equals(element)) return true;
167
168
        var contentContent = switch (element) {
169
            case ContentAccessor accessor -> accessor.getContent();
170
            case SdtRun sdtRun -> sdtRun.getSdtContent()
171
                                        .getContent();
172
            default -> {
173
                log.warn("Element {} not recognized", element);
174
                yield emptyList();
175
            }
176
        };
177
178 2 1. depthElementSearch : replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED
2. depthElementSearch : replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED
        return contentContent.stream()
179 2 1. lambda$depthElementSearch$0 : replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::lambda$depthElementSearch$0 → KILLED
2. lambda$depthElementSearch$0 : replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::lambda$depthElementSearch$0 → KILLED
                             .anyMatch(obj -> depthElementSearch(searchTarget, obj));
180
    }
181
182
    private static ContentAccessor findInsertableParent(Object searchFrom) {
183 1 1. findInsertableParent : replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findInsertableParent → KILLED
        return switch (searchFrom) {
184
            case Tc tc -> tc;
185
            case Body body -> body;
186
            case Child child -> findInsertableParent(child.getParent());
187
            default -> throw new OfficeStamperException("Unexpected parent " + searchFrom.getClass());
188
        };
189
    }
190
191
    /**
192
     * Visits the document's main content, header, footer, footnotes, and endnotes using
193
     * the specified visitor.
194
     *
195
     * @param document the WordprocessingMLPackage representing the document to be visited
196
     * @param visitor  the TraversalUtilVisitor to be applied to each relevant part of the document
197
     */
198
    public static void visitDocument(WordprocessingMLPackage document, TraversalUtilVisitor<?> visitor) {
199
        var mainDocumentPart = document.getMainDocumentPart();
200 1 1. visitDocument : removed call to org/docx4j/TraversalUtil::visit → KILLED
        TraversalUtil.visit(mainDocumentPart, visitor);
201 2 1. visitDocument : removed call to java/util/stream/Stream::forEach → SURVIVED
2. lambda$visitDocument$1 : removed call to org/docx4j/TraversalUtil::visit → NO_COVERAGE
        streamHeaderFooterPart(document).forEach(f -> TraversalUtil.visit(f, visitor));
202 1 1. visitDocument : removed call to pro/verron/officestamper/core/DocumentUtil::visitPartIfExists → KILLED
        visitPartIfExists(visitor, mainDocumentPart.getFootnotesPart());
203 1 1. visitDocument : removed call to pro/verron/officestamper/core/DocumentUtil::visitPartIfExists → KILLED
        visitPartIfExists(visitor, mainDocumentPart.getEndNotesPart());
204
    }
205
206
    private static Stream<Object> streamHeaderFooterPart(WordprocessingMLPackage document) {
207 1 1. streamHeaderFooterPart : replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::streamHeaderFooterPart → SURVIVED
        return document.getDocumentModel()
208
                       .getSections()
209
                       .stream()
210
                       .map(SectionWrapper::getHeaderFooterPolicy)
211
                       .flatMap(DocumentUtil::extractHeaderFooterParts);
212
    }
213
214
    private static void visitPartIfExists(TraversalUtilVisitor<?> visitor, @Nullable JaxbXmlPart<?> part) {
215
        ThrowingFunction<JaxbXmlPart<?>, Object> throwingFunction = JaxbXmlPart::getContents;
216
        Optional.ofNullable(part)
217 1 1. lambda$visitPartIfExists$2 : replaced return value with null for pro/verron/officestamper/core/DocumentUtil::lambda$visitPartIfExists$2 → KILLED
                .map(c -> throwingFunction.apply(c, OfficeStamperException::new))
218 2 1. lambda$visitPartIfExists$3 : removed call to org/docx4j/TraversalUtil::visit → KILLED
2. visitPartIfExists : removed call to java/util/Optional::ifPresent → KILLED
                .ifPresent(c -> TraversalUtil.visit(c, visitor));
219
    }
220
221
    private static Stream<JaxbXmlPart<?>> extractHeaderFooterParts(HeaderFooterPolicy hfp) {
222
        Builder<JaxbXmlPart<?>> builder = Stream.builder();
223 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getFirstHeader()).ifPresent(builder::add);
224 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getDefaultHeader()).ifPresent(builder::add);
225 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getEvenHeader()).ifPresent(builder::add);
226 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getFirstFooter()).ifPresent(builder::add);
227 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getDefaultFooter()).ifPresent(builder::add);
228 1 1. extractHeaderFooterParts : removed call to java/util/Optional::ifPresent → SURVIVED
        ofNullable(hfp.getEvenFooter()).ifPresent(builder::add);
229 1 1. extractHeaderFooterParts : replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::extractHeaderFooterParts → SURVIVED
        return builder.build();
230
    }
231
}

Mutations

57

1.1
Location : streamObjectElements
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#29]
removed call to org/docx4j/TraversalUtil::visit → KILLED

58

1.1
Location : streamObjectElements
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#29]
replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::streamObjectElements → KILLED

69

1.1
Location : allElements
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#8]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocumentUtil::allElements → KILLED

82

1.1
Location : walkObjectsAndImportImages
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[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/core/DocumentUtil::walkObjectsAndImportImages → KILLED

104

1.1
Location : walkObjectsAndImportImages
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[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

107

1.1
Location : walkObjectsAndImportImages
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:#1]
negated conditional → KILLED

2.2
Location : walkObjectsAndImportImages
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:#1]
negated conditional → KILLED

115

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

119

1.1
Location : walkObjectsAndImportImages
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[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/core/DocumentUtil::walkObjectsAndImportImages → KILLED

123

1.1
Location : containsImage
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:#1]
replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::containsImage → KILLED

2.2
Location : containsImage
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[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 boolean return with false for pro/verron/officestamper/core/DocumentUtil::containsImage → KILLED

133

1.1
Location : tryCreateImagePart
Killed by : pro.verron.officestamper.test.RepeatDocPartTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatDocPartTest]/[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 null for pro/verron/officestamper/core/DocumentUtil::tryCreateImagePart → KILLED

150

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

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

151

1.1
Location : findSmallestCommonParent
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findSmallestCommonParent → KILLED

152

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

2.2
Location : findSmallestCommonParent
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findSmallestCommonParent → KILLED

166

1.1
Location : depthElementSearch
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED

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

178

1.1
Location : depthElementSearch
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED

2.2
Location : depthElementSearch
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#6]
replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED

179

1.1
Location : lambda$depthElementSearch$0
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#6]
replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::lambda$depthElementSearch$0 → KILLED

2.2
Location : lambda$depthElementSearch$0
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::lambda$depthElementSearch$0 → KILLED

183

1.1
Location : findInsertableParent
Killed by : pro.verron.officestamper.test.RepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RepeatParagraphTest]/[method:shouldAcceptSet()]
replaced return value with null for pro/verron/officestamper/core/DocumentUtil::findInsertableParent → KILLED

200

1.1
Location : visitDocument
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#2]
removed call to org/docx4j/TraversalUtil::visit → KILLED

201

1.1
Location : visitDocument
Killed by : none
removed call to java/util/stream/Stream::forEach → SURVIVED
Covering tests

2.2
Location : lambda$visitDocument$1
Killed by : none
removed call to org/docx4j/TraversalUtil::visit → NO_COVERAGE

202

1.1
Location : visitDocument
Killed by : pro.verron.officestamper.test.ConditionalDisplayTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ConditionalDisplayTest]/[test-template:conditionalDisplayOfFootnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
removed call to pro/verron/officestamper/core/DocumentUtil::visitPartIfExists → KILLED

203

1.1
Location : visitDocument
Killed by : pro.verron.officestamper.test.ConditionalDisplayTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ConditionalDisplayTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#1]
removed call to pro/verron/officestamper/core/DocumentUtil::visitPartIfExists → KILLED

207

1.1
Location : streamHeaderFooterPart
Killed by : none
replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::streamHeaderFooterPart → SURVIVED
Covering tests

217

1.1
Location : lambda$visitPartIfExists$2
Killed by : pro.verron.officestamper.test.ConditionalDisplayTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ConditionalDisplayTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#1]
replaced return value with null for pro/verron/officestamper/core/DocumentUtil::lambda$visitPartIfExists$2 → KILLED

218

1.1
Location : lambda$visitPartIfExists$3
Killed by : pro.verron.officestamper.test.ConditionalDisplayTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ConditionalDisplayTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#1]
removed call to org/docx4j/TraversalUtil::visit → KILLED

2.2
Location : visitPartIfExists
Killed by : pro.verron.officestamper.test.ConditionalDisplayTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ConditionalDisplayTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#1]
removed call to java/util/Optional::ifPresent → KILLED

223

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

224

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

225

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

226

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

227

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

228

1.1
Location : extractHeaderFooterParts
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED
Covering tests

229

1.1
Location : extractHeaderFooterParts
Killed by : none
replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::extractHeaderFooterParts → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.20.0