EvaluationContextFactories.java

1
package pro.verron.officestamper.preset;
2
3
4
import org.springframework.expression.EvaluationContext;
5
import org.springframework.expression.spel.support.StandardEvaluationContext;
6
import pro.verron.officestamper.api.EvaluationContextFactory;
7
import pro.verron.officestamper.api.OfficeStamperException;
8
9
/// Utility class for configuring the [EvaluationContext] used by officestamper.
10
/// @deprecated since 3.4, for removal in a future version. The use of this class is no longer recommended.
11
@Deprecated(since = "3.4", forRemoval = true) public class EvaluationContextFactories {
12
13
    private EvaluationContextFactories() {
14
        throw new OfficeStamperException("EvaluationContextConfigurers cannot be instantiated");
15
    }
16
17
    /// Returns an [EvaluationContextFactory] instance that does no customization.
18
    /// This factory does nothing to the [StandardEvaluationContext] class, and therefore all the unfiltered features
19
    /// are accessible. It should be used when there is a need to use the powerful features of the aforementioned class,
20
    /// and there is a trust that the template won't contain any dangerous injections.
21
    ///
22
    /// @return an [EvaluationContextFactory] instance
23
    /// @deprecated since 3.4, for removal in a future version. The use of this factory is no longer recommended.
24
    @Deprecated(since = "3.4", forRemoval = true)
25
    public static EvaluationContextFactory noopFactory() {
26 1 1. noopFactory : replaced return value with null for pro/verron/officestamper/preset/EvaluationContextFactories::noopFactory → KILLED
        return pro.verron.officestamper.api.EvaluationContextFactories.permissiveFactory();
27
    }
28
29
    /// Returns a default [EvaluationContextFactory] instance.
30
    /// The default factory provides better default security for the [EvaluationContext] used by OfficeStamper. It
31
    /// sets up the context with enhanced security measures, such as limited property accessors, constructor resolvers,
32
    /// and method resolvers. It also sets a type locator, type converter, type comparator, and operator overloader.
33
    /// This factory is recommended to be used when there is a need for improved security and protection against
34
    /// potentially dangerous injections in the template.
35
    ///
36
    /// @return an [EvaluationContextFactory] instance with enhanced security features
37
    /// @deprecated since 3.4, for removal in a future version. The use of this factory is no longer recommended.
38
    @Deprecated(since = "3.4", forRemoval = true)
39
    public static EvaluationContextFactory defaultFactory() {
40 1 1. defaultFactory : replaced return value with null for pro/verron/officestamper/preset/EvaluationContextFactories::defaultFactory → SURVIVED
        return pro.verron.officestamper.api.EvaluationContextFactories.restrictedFactory();
41
    }
42
43
}

Mutations

26

1.1
Location : noopFactory
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/EvaluationContextFactories::noopFactory → KILLED

40

1.1
Location : defaultFactory
Killed by : none
replaced return value with null for pro/verron/officestamper/preset/EvaluationContextFactories::defaultFactory → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.23.1 support