OfficeStamperException.java

1
package pro.verron.officestamper.api;
2
3
import org.springframework.util.function.ThrowingFunction;
4
5
import java.util.function.Function;
6
import java.util.function.Supplier;
7
8
/**
9
 * OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during the
10
 * processing of an Office document using the OfficeStamper library.
11
 * It provides additional constructors to handle different scenarios.
12
 */
13
public class OfficeStamperException
14
        extends RuntimeException {
15
    /**
16
     * OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown
17
     * during the processing of an Office document using the OfficeStamper
18
     * library.
19
     *
20
     * @param message a message describing the error
21
     */
22
    public OfficeStamperException(String message) {
23
        super(message);
24
    }
25
26
    /**
27
     * OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown
28
     * during the processing of an Office document using the OfficeStamper
29
     * library.
30
     *
31
     * @param cause the cause of the exception
32
     */
33
    public OfficeStamperException(Throwable cause) {
34
        super(cause);
35
    }
36
37
    /**
38
     * OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown
39
     * during the processing of an Office document using the OfficeStamper
40
     * library.
41
     *
42
     * @param message a message describing the error
43
     * @param cause   the cause of the exception
44
     */
45
    public OfficeStamperException(String message, Throwable cause) {
46
        super(message, cause);
47
    }
48
49
    /**
50
     * OfficeStamperException is a subclass of RuntimeException
51
     * that represents an exception
52
     * that can be thrown during the processing of an Office document using the OfficeStamper
53
     * library.
54
     */
55
    public OfficeStamperException() {
56
        super("Unexpected exception");
57
    }
58
59
    /**
60
     * Creates a supplier that returns a new instance of {@link OfficeStamperException} with the specified message.
61
     *
62
     * @param message the message describing the exception
63
     * @return a supplier that provides a new {@link OfficeStamperException} instance
64
     */
65
    public static Supplier<OfficeStamperException> throwing(String message) {
66 2 1. lambda$throwing$0 : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::lambda$throwing$0 → NO_COVERAGE
2. throwing : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → SURVIVED
        return () -> new OfficeStamperException(message);
67
    }
68
69
    /**
70
     * Wraps a ThrowingFunction into a standard Java Function, converting any checked exceptions
71
     * thrown by the original function into an OfficeStamperException.
72
     *
73
     * @param <T> the type of the input to the function
74
     * @param <U> the type of the result of the function
75
     * @param function the throwing function to be wrapped
76
     * @return a Function that wraps the specified ThrowingFunction and handles exceptions by
77
     *         throwing an OfficeStamperException
78
     */
79
    public static <T, U> Function<T, U> throwing(ThrowingFunction<T, U> function) {
80 1 1. throwing : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → KILLED
        return ThrowingFunction.of(function, OfficeStamperException::new);
81
    }
82
}

Mutations

66

1.1
Location : lambda$throwing$0
Killed by : none
replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::lambda$throwing$0 → NO_COVERAGE

2.2
Location : throwing
Killed by : none
replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → SURVIVED
Covering tests

80

1.1
Location : throwing
Killed by : pro.verron.officestamper.test.SpelInstantiationTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInstantiationTest]/[test-template:testDateInstantiationAndResolution(pro.verron.officestamper.test.ContextFactory)]/[test-template-invocation:#2]
replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.0