RprLangVisitor.java

1
package pro.verron.officestamper.preset.preprocessors.rmlang;
2
3
import org.docx4j.utils.TraversalUtilVisitor;
4
import org.docx4j.wml.R;
5
import org.docx4j.wml.RPr;
6
7
import java.util.ArrayList;
8
import java.util.List;
9
10
/// A visitor implementation for processing Run Properties (RPr) language elements in DOCX documents. This class extends
11
/// TraversalUtilVisitor to traverse and collect RPr elements that contain language information.
12
///
13
/// This visitor is specifically designed to identify and store RPr objects that have non-null language settings, which
14
/// can be used for further processing or analysis of document formatting.
15
public class RprLangVisitor
16
        extends TraversalUtilVisitor<R> {
17
    private final List<RPr> rPrs = new ArrayList<>();
18
19
    @Override
20
    public void apply(R element, Object parent1, List<Object> siblings) {
21
        var elementRPr = element.getRPr();
22 1 1. apply : negated conditional → KILLED
        if (elementRPr == null) return;
23
        var elementLang = elementRPr.getLang();
24 1 1. apply : negated conditional → SURVIVED
        if (elementLang == null) return;
25
        rPrs.add(elementRPr);
26
    }
27
28
29
    /// Returns the list of RPr elements that have been collected during the traversal. These RPr elements contain
30
    /// language information and were identified as having non-null language settings.
31
    ///
32
    /// @return a list of RPr elements with language information
33
    public List<RPr> getrPrs() {
34 1 1. getrPrs : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/preprocessors/rmlang/RprLangVisitor::getrPrs → TIMED_OUT
        return rPrs;
35
    }
36
}

Mutations

22

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

24

1.1
Location : apply
Killed by : none
negated conditional → SURVIVED
Covering tests

34

1.1
Location : getrPrs
Killed by : none
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/preprocessors/rmlang/RprLangVisitor::getrPrs → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.22.0