OpenpackagingFactory.java

1
package pro.verron.officestamper.utils.openpackaging;
2
3
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
4
import org.docx4j.openpackaging.parts.PartName;
5
import pro.verron.officestamper.utils.UtilsException;
6
7
/// Utility class for creating Open Packaging objects.
8
///
9
/// This class provides helper methods to create instances of docx4j Open Packaging objects, wrapping checked exceptions
10
/// in runtime [UtilsException] for easier handling.
11
public class OpenpackagingFactory {
12
13
    private OpenpackagingFactory() {
14
        throw new UtilsException("Utility class shouldn't be instantiated");
15
    }
16
17
    /// Creates a new PartName instance from the given string representation.
18
    ///
19
    /// This method wraps the checked [InvalidFormatException] that can occur when creating a PartName in a runtime
20
    /// [UtilsException].
21
    ///
22
    /// @param partName the string representation of the part name
23
    ///
24
    /// @return a new PartName instance
25
    ///
26
    /// @throws UtilsException if the part name string is invalid
27
    public static PartName newPartName(String partName) {
28
        try {
29 1 1. newPartName : replaced return value with null for pro/verron/officestamper/utils/openpackaging/OpenpackagingFactory::newPartName → NO_COVERAGE
            return new PartName(partName);
30
        } catch (InvalidFormatException e) {
31
            throw new UtilsException(e);
32
        }
33
    }
34
}

Mutations

29

1.1
Location : newPartName
Killed by : none
replaced return value with null for pro/verron/officestamper/utils/openpackaging/OpenpackagingFactory::newPartName → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.0