Postprocessors.java

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

Mutations

25

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

35

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

46

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

Active mutators

Tests examined


Report generated by PIT 1.22.0