UnionEvaluationContext.java

1
package pro.verron.officestamper.core;
2
3
import org.jspecify.annotations.Nullable;
4
import org.springframework.expression.*;
5
6
import java.util.ArrayList;
7
import java.util.List;
8
import java.util.Objects;
9
10
/// An {@link EvaluationContext} that combines multiple contexts.
11
public class UnionEvaluationContext
12
        implements EvaluationContext {
13
    private final EvaluationContext evaluationContext;
14
    private final Invokers invokers;
15
16
    UnionEvaluationContext(EvaluationContext evaluationContext, Invokers invokers) {
17
        this.evaluationContext = evaluationContext;
18
        this.invokers = invokers;
19
    }
20
21
    @Override
22
    public TypedValue getRootObject() {
23 1 1. getRootObject : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getRootObject → KILLED
        return evaluationContext.getRootObject();
24
    }
25
26
    @Override
27
    public List<PropertyAccessor> getPropertyAccessors() {
28
        var accessors = evaluationContext.getPropertyAccessors();
29
        var unionAccessors = new ArrayList<>(accessors);
30 1 1. getPropertyAccessors : removed call to java/util/ArrayList::addFirst → TIMED_OUT
        unionAccessors.addFirst(new UnionPropertyAccessor(accessors));
31 1 1. getPropertyAccessors : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getPropertyAccessors → TIMED_OUT
        return unionAccessors;
32
    }
33
34
    @Override
35
    public List<IndexAccessor> getIndexAccessors() {
36
        var accessors = evaluationContext.getIndexAccessors();
37
        var unionAccessors = new ArrayList<>(accessors);
38 1 1. getIndexAccessors : removed call to java/util/ArrayList::addFirst → NO_COVERAGE
        unionAccessors.addFirst(new UnionIndexAccessor(accessors));
39 1 1. getIndexAccessors : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getIndexAccessors → NO_COVERAGE
        return unionAccessors;
40
    }
41
42
    @Override
43
    public List<ConstructorResolver> getConstructorResolvers() {
44 1 1. getConstructorResolvers : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getConstructorResolvers → KILLED
        return evaluationContext.getConstructorResolvers();
45
    }
46
47
    @Override
48
    public List<MethodResolver> getMethodResolvers() {
49
        var resolvers = evaluationContext.getMethodResolvers();
50
        var unionResolvers = new ArrayList<>(resolvers);
51 1 1. getMethodResolvers : removed call to java/util/ArrayList::addFirst → TIMED_OUT
        unionResolvers.addFirst(new UnionMethodResolver(resolvers));
52
        unionResolvers.add(invokers);
53 1 1. getMethodResolvers : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getMethodResolvers → KILLED
        return unionResolvers;
54
    }
55
56
    @Override
57
    @Nullable
58
    public BeanResolver getBeanResolver() {
59 1 1. getBeanResolver : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getBeanResolver → NO_COVERAGE
        return evaluationContext.getBeanResolver();
60
    }
61
62
    @Override
63
    public TypeLocator getTypeLocator() {
64 1 1. getTypeLocator : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeLocator → KILLED
        return evaluationContext.getTypeLocator();
65
    }
66
67
    @Override
68
    public TypeConverter getTypeConverter() {
69 1 1. getTypeConverter : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeConverter → TIMED_OUT
        return evaluationContext.getTypeConverter();
70
    }
71
72
    @Override
73
    public TypeComparator getTypeComparator() {
74 1 1. getTypeComparator : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeComparator → NO_COVERAGE
        return evaluationContext.getTypeComparator();
75
    }
76
77
    @Override
78
    public OperatorOverloader getOperatorOverloader() {
79 1 1. getOperatorOverloader : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getOperatorOverloader → NO_COVERAGE
        return evaluationContext.getOperatorOverloader();
80
    }
81
82
    @Override
83
    public void setVariable(String name, @Nullable Object value) {
84 1 1. setVariable : removed call to org/springframework/expression/EvaluationContext::setVariable → NO_COVERAGE
        evaluationContext.setVariable(name, value);
85
    }
86
87
    @Override
88
    @Nullable
89
    public Object lookupVariable(String name) {
90 1 1. lookupVariable : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::lookupVariable → NO_COVERAGE
        return evaluationContext.lookupVariable(name);
91
    }
92
93
    /// Returns the wrapped evaluation context.
94
    ///
95
    /// @return the evaluation context
96 1 1. evaluationContext : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::evaluationContext → NO_COVERAGE
    public EvaluationContext evaluationContext() {return evaluationContext;}
97
98
    /// Returns the invokers.
99
    ///
100
    /// @return the invokers
101 1 1. invokers : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::invokers → NO_COVERAGE
    public Invokers invokers() {return invokers;}
102
103
    @Override
104
    public int hashCode() {
105 1 1. hashCode : replaced int return with 0 for pro/verron/officestamper/core/UnionEvaluationContext::hashCode → NO_COVERAGE
        return Objects.hash(evaluationContext, invokers);
106
    }
107
108
    @Override
109
    public boolean equals(Object obj) {
110 2 1. equals : replaced boolean return with false for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
        if (obj == this) return true;
111 3 1. equals : negated conditional → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
3. equals : replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE
        if (obj == null || obj.getClass() != this.getClass()) return false;
112
        var that = (UnionEvaluationContext) obj;
113 3 1. equals : negated conditional → NO_COVERAGE
2. equals : replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE
3. equals : negated conditional → NO_COVERAGE
        return Objects.equals(this.evaluationContext, that.evaluationContext) && Objects.equals(this.invokers,
114
                that.invokers);
115
    }
116
117
    @Override
118
    public String toString() {
119 1 1. toString : replaced return value with "" for pro/verron/officestamper/core/UnionEvaluationContext::toString → TIMED_OUT
        return "UnionEvaluationContext[" + "evaluationContext=" + evaluationContext + ", " + "invokers=" + invokers
120
               + ']';
121
    }
122
123
124
}

Mutations

23

1.1
Location : getRootObject
Killed by : pro.verron.officestamper.test.SpelInjectionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInjectionTest]/[test-template:spelInjectionTest(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getRootObject → KILLED

30

1.1
Location : getPropertyAccessors
Killed by : none
removed call to java/util/ArrayList::addFirst → TIMED_OUT

31

1.1
Location : getPropertyAccessors
Killed by : none
replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getPropertyAccessors → TIMED_OUT

38

1.1
Location : getIndexAccessors
Killed by : none
removed call to java/util/ArrayList::addFirst → NO_COVERAGE

39

1.1
Location : getIndexAccessors
Killed by : none
replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getIndexAccessors → NO_COVERAGE

44

1.1
Location : getConstructorResolvers
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 Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getConstructorResolvers → KILLED

51

1.1
Location : getMethodResolvers
Killed by : none
removed call to java/util/ArrayList::addFirst → TIMED_OUT

53

1.1
Location : getMethodResolvers
Killed by : pro.verron.officestamper.test.CustomProcessorTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomProcessorTests]/[test-template:should_allow_custom_processors_injection(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#1]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getMethodResolvers → KILLED

59

1.1
Location : getBeanResolver
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getBeanResolver → NO_COVERAGE

64

1.1
Location : getTypeLocator
Killed by : pro.verron.officestamper.test.SpelInjectionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInjectionTest]/[test-template:spelInjectionTest(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeLocator → KILLED

69

1.1
Location : getTypeConverter
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeConverter → TIMED_OUT

74

1.1
Location : getTypeComparator
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeComparator → NO_COVERAGE

79

1.1
Location : getOperatorOverloader
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getOperatorOverloader → NO_COVERAGE

84

1.1
Location : setVariable
Killed by : none
removed call to org/springframework/expression/EvaluationContext::setVariable → NO_COVERAGE

90

1.1
Location : lookupVariable
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::lookupVariable → NO_COVERAGE

96

1.1
Location : evaluationContext
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::evaluationContext → NO_COVERAGE

101

1.1
Location : invokers
Killed by : none
replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::invokers → NO_COVERAGE

105

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for pro/verron/officestamper/core/UnionEvaluationContext::hashCode → NO_COVERAGE

110

1.1
Location : equals
Killed by : none
replaced boolean return with false for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

111

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE

113

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE

3.3
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

119

1.1
Location : toString
Killed by : none
replaced return value with "" for pro/verron/officestamper/core/UnionEvaluationContext::toString → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.22.0