Postprocessors.java

1
package pro.verron.officestamper.preset;
2
3
import pro.verron.officestamper.api.CommentRemover;
4
import pro.verron.officestamper.api.HookRemover;
5
import pro.verron.officestamper.api.OfficeStamperException;
6
import pro.verron.officestamper.api.PostProcessor;
7
import pro.verron.officestamper.preset.postprocessors.cleanendnotes.RemoveOrphanedEndnotesProcessor;
8
import pro.verron.officestamper.preset.postprocessors.cleanfootnotes.RemoveOrphanedFootnotesProcessor;
9
10
/// The Postprocessors class provides static utility methods for obtaining implementations of the [PostProcessor]
11
/// interface that perform specific post-processing operations on WordprocessingMLPackage documents.
12
///
13
/// This class is a utility class and cannot be instantiated.
14
public class Postprocessors {
15
    private Postprocessors() {
16
        throw new OfficeStamperException("This is a utility class and cannot be instantiated");
17
    }
18
19
    /// Creates a PostProcessor that removes orphaned footnotes from a WordprocessingMLPackage document. An orphaned
20
    /// footnote is a footnote that is defined in the document but does not have a corresponding reference in the main
21
    /// content. This PostProcessor ensures that such unused footnotes are cleaned up, maintaining the structural
22
    /// integrity of the document.
23
    ///
24
    /// @return a PostProcessor instance that performs the removal of orphaned footnotes
25
    public static PostProcessor removeOrphanedFootnotes() {
26 1 1. removeOrphanedFootnotes : replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeOrphanedFootnotes → KILLED
        return new RemoveOrphanedFootnotesProcessor();
27
    }
28
29
    /// Creates a PostProcessor that removes orphaned endnotes from a WordprocessingMLPackage document. An orphaned
30
    /// endnote is an endnote that is defined in the document but does not have a corresponding reference in the main
31
    /// content. This PostProcessor ensures that such unused endnotes are cleaned up, maintaining the integrity and
32
    /// consistency of the document.
33
    ///
34
    /// @return a PostProcessor instance that performs the removal of orphaned endnotes
35
    public static PostProcessor removeOrphanedEndnotes() {
36 1 1. removeOrphanedEndnotes : replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeOrphanedEndnotes → KILLED
        return new RemoveOrphanedEndnotesProcessor();
37
    }
38
39
    /// Creates a PostProcessor that removes specified XML elements from a WordprocessingMLPackage document. This
40
    /// PostProcessor searches for and removes all occurrences of the specified element tag within the document, helping
41
    /// to clean up temporary or unwanted markup that may have been used during the stamping process.
42
    ///
43
    /// @param element the name of the XML element to be removed from the document
44
    ///
45
    /// @return a [PostProcessor] instance that performs the removal of specified tags
46
    public static PostProcessor removeTags(String element) {
47 1 1. removeTags : replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeTags → KILLED
        return new HookRemover(element);
48
    }
49
50
    public static PostProcessor removeComments() {
51 1 1. removeComments : replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeComments → KILLED
        return new CommentRemover();
52
    }
53
}

Mutations

26

1.1
Location : removeOrphanedFootnotes
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/Postprocessors::removeOrphanedFootnotes → KILLED

36

1.1
Location : removeOrphanedEndnotes
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/Postprocessors::removeOrphanedEndnotes → KILLED

47

1.1
Location : removeTags
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[method:testTableOfContent()]
replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeTags → KILLED

51

1.1
Location : removeComments
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[method:testTableOfContent()]
replaced return value with null for pro/verron/officestamper/preset/Postprocessors::removeComments → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.0