ExperimentalStampers.java

1
package pro.verron.officestamper.preset;
2
3
import org.docx4j.openpackaging.exceptions.Docx4JException;
4
import org.docx4j.openpackaging.packages.PresentationMLPackage;
5
import org.docx4j.openpackaging.packages.SpreadsheetMLPackage;
6
import pro.verron.officestamper.api.OfficeStamper;
7
import pro.verron.officestamper.api.OfficeStamperException;
8
import pro.verron.officestamper.api.StreamStamper;
9
import pro.verron.officestamper.experimental.ExcelStamper;
10
import pro.verron.officestamper.experimental.PowerpointStamper;
11
12
import java.io.InputStream;
13
14
/**
15
 * ExperimentalStampers is a class that provides static methods for obtaining instances of OfficeStamper
16
 * implementations for stamping PowerPoint presentations and Excel templates with context and writing
17
 * the result to an OutputStream.
18
 *
19
 * @since 1.6.8
20
 */
21
public class ExperimentalStampers {
22
23
    private ExperimentalStampers() {
24
        throw new OfficeStamperException("ExperimentalStampers cannot be instantiated");
25
    }
26
27
    /**
28
     * Returns a new instance of the OfficeStamper implementation
29
     * for stamping PowerPoint presentations with context and writing
30
     * the result to an OutputStream.
31
     *
32
     * @return a new OfficeStamper instance for PowerPoint presentations
33
     *
34
     * @since 1.6.8
35
     */
36
    public static StreamStamper<PresentationMLPackage> pptxStamper() {
37
        var stamper = new PowerpointStamper();
38 1 1. pptxStamper : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::pptxStamper → KILLED
        return new StreamStamper<>(ExperimentalStampers::loadPowerPoint, stamper);
39
    }
40
41
    private static PresentationMLPackage loadPowerPoint(InputStream inputStream) {
42
        try {
43 1 1. loadPowerPoint : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::loadPowerPoint → KILLED
            return PresentationMLPackage.load(inputStream);
44
        } catch (Docx4JException e) {
45
            throw new OfficeStamperException(e);
46
        }
47
    }
48
49
    /**
50
     * Returns a new instance of the OfficeStamper implementation
51
     * for stamping Excel templates with context and writing the result to an OutputStream.
52
     *
53
     * @return a new OfficeStamper instance for Excel templates
54
     *
55
     * @since 1.6.8
56
     */
57
    public static OfficeStamper<SpreadsheetMLPackage> xlsxStamper() {
58 1 1. xlsxStamper : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::xlsxStamper → KILLED
        return new ExcelStamper();
59
    }
60
}

Mutations

38

1.1
Location : pptxStamper
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::pptxStamper → KILLED

43

1.1
Location : loadPowerPoint
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::loadPowerPoint → KILLED

58

1.1
Location : xlsxStamper
Killed by : pro.verron.officestamper.test.BasicExcelTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicExcelTest]/[method:testStamper()]
replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::xlsxStamper → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.0