Preprocessors.java

1
package pro.verron.officestamper.preset;
2
3
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
4
import org.docx4j.wml.ProofErr;
5
import pro.verron.officestamper.api.CommentHooker;
6
import pro.verron.officestamper.api.OfficeStamperException;
7
import pro.verron.officestamper.api.PlaceholderHooker;
8
import pro.verron.officestamper.api.PreProcessor;
9
import pro.verron.officestamper.preset.preprocessors.malformedcomments.RemoveMalformedComments;
10
import pro.verron.officestamper.preset.preprocessors.prooferror.RemoveProofErrors;
11
import pro.verron.officestamper.preset.preprocessors.rmlang.RemoveLang;
12
import pro.verron.officestamper.preset.preprocessors.similarrun.MergeSameStyleRuns;
13
14
/// A helper class that provides pre-processing functionality for [WordprocessingMLPackage] documents.
15
public class Preprocessors {
16
17
    private Preprocessors() {
18
        throw new OfficeStamperException("Preprocessors cannot be instantiated");
19
    }
20
21
    /// Returns a [PreProcessor] object that merges same style runs that are next to each other in a
22
    /// [WordprocessingMLPackage] document.
23
    ///
24
    /// @return a [PreProcessor] object that merges similar runs.
25
    public static PreProcessor mergeSimilarRuns() {
26 1 1. mergeSimilarRuns : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::mergeSimilarRuns → KILLED
        return new MergeSameStyleRuns();
27
    }
28
29
    /// Returns a [PreProcessor] object that removes all [ProofErr] elements from the [WordprocessingMLPackage]
30
    /// document.
31
    ///
32
    /// @return a [PreProcessor] object that removes [ProofErr] elements.
33
    public static PreProcessor removeLanguageProof() {
34 1 1. removeLanguageProof : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeLanguageProof → KILLED
        return new RemoveProofErrors();
35
    }
36
37
    /// Returns a [PreProcessor] object that removes all language informations such as grammatical and orthographics
38
    /// markers in a [WordprocessingMLPackage] document.
39
    ///
40
    /// @return a [PreProcessor] object that removes language markers.
41
    public static PreProcessor removeLanguageInfo() {
42 1 1. removeLanguageInfo : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeLanguageInfo → KILLED
        return new RemoveLang();
43
    }
44
45
    /// Returns a [PreProcessor] object that removes comments information that is not conforming to the expected
46
    /// patterns.
47
    ///
48
    /// @return a [PreProcessor] object that removes malformed comments markers.
49
    public static PreProcessor removeMalformedComments() {
50 1 1. removeMalformedComments : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeMalformedComments → KILLED
        return new RemoveMalformedComments();
51
    }
52
53
    /// Returns a [PreProcessor] object that prepares inline placeholders based on the provided regex and element name.
54
    ///
55
    /// @param regex the regular expression used to identify placeholders in the document
56
    /// @param element the name of the smart tag element to be used for the placeholders
57
    ///
58
    /// @return a [PreProcessor] object that prepares inline placeholders.
59
    public static PreProcessor preparePlaceholders(String regex, String element) {
60 1 1. preparePlaceholders : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::preparePlaceholders → KILLED
        return new PlaceholderHooker(regex, element);
61
    }
62
63
64
    /// Returns a [PreProcessor] object that prepares comment processors for use with the stamper.
65
    ///
66
    /// @return a [PreProcessor] object that prepares comment processors.
67
    public static PreProcessor prepareCommentProcessor() {
68 1 1. prepareCommentProcessor : replaced return value with null for pro/verron/officestamper/preset/Preprocessors::prepareCommentProcessor → KILLED
        return new CommentHooker();
69
    }
70
}

Mutations

26

1.1
Location : mergeSimilarRuns
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]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::mergeSimilarRuns → KILLED

34

1.1
Location : removeLanguageProof
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]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeLanguageProof → KILLED

42

1.1
Location : removeLanguageInfo
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]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeLanguageInfo → KILLED

50

1.1
Location : removeMalformedComments
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[test-template:fails(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#1]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::removeMalformedComments → KILLED

60

1.1
Location : preparePlaceholders
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[test-template:fails(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#1]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::preparePlaceholders → KILLED

68

1.1
Location : prepareCommentProcessor
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[test-template:fails(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#1]
replaced return value with null for pro/verron/officestamper/preset/Preprocessors::prepareCommentProcessor → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.0