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

Mutations

53

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:#22]
removed call to org/docx4j/TraversalUtil::visit → KILLED

54

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:#22]
replaced return value with Stream.empty for pro/verron/officestamper/core/DocumentUtil::streamObjectElements → KILLED

63

1.1
Location : allElements
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/core/DocumentUtil::allElements → KILLED

74

1.1
Location : walkObjectsAndImportImages
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/core/DocumentUtil::walkObjectsAndImportImages → KILLED

94

1.1
Location : walkObjectsAndImportImages
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

97

1.1
Location : walkObjectsAndImportImages
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

2.2
Location : walkObjectsAndImportImages
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

105

1.1
Location : walkObjectsAndImportImages
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

109

1.1
Location : walkObjectsAndImportImages
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/core/DocumentUtil::walkObjectsAndImportImages → KILLED

113

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

2.2
Location : containsImage
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 boolean return with false for pro/verron/officestamper/core/DocumentUtil::containsImage → KILLED

123

1.1
Location : tryCreateImagePart
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 null for pro/verron/officestamper/core/DocumentUtil::tryCreateImagePart → KILLED

138

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

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

139

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

140

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

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

152

1.1
Location : depthElementSearch
Killed by : pro.verron.officestamper.test.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[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.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#2]
negated conditional → KILLED

164

1.1
Location : depthElementSearch
Killed by : pro.verron.officestamper.test.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[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.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#2]
replaced boolean return with true for pro/verron/officestamper/core/DocumentUtil::depthElementSearch → KILLED

165

1.1
Location : lambda$depthElementSearch$0
Killed by : pro.verron.officestamper.test.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#2]
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.ProcessorRepeatParagraphTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorRepeatParagraphTest]/[method:shouldAcceptSet()]
replaced boolean return with false for pro/verron/officestamper/core/DocumentUtil::lambda$depthElementSearch$0 → KILLED

169

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

184

1.1
Location : visitDocument
Killed by : pro.verron.officestamper.test.ProcessorDisplayIfTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorDisplayIfTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
removed call to org/docx4j/TraversalUtil::visit → KILLED

185

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

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

186

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

187

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

191

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

201

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

202

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

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

207

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

208

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

209

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

210

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

211

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

212

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

213

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