TriFunctionBuilder.java

1
package pro.verron.officestamper.core.functions;
2
3
import pro.verron.officestamper.api.CustomFunction;
4
import pro.verron.officestamper.core.DocxStamperConfiguration;
5
import pro.verron.officestamper.utils.TriFunction;
6
7
import java.util.List;
8
import java.util.function.Function;
9
10
public class TriFunctionBuilder<T, U, V>
11
        implements CustomFunction.NeedsTriFunctionImpl<T, U, V> {
12
    private final DocxStamperConfiguration source;
13
    private final String name;
14
    private final Class<T> class0;
15
    private final Class<U> class1;
16
    private final Class<V> class2;
17
18
    public TriFunctionBuilder(
19
            DocxStamperConfiguration source, String name, Class<T> class0, Class<U> class1, Class<V> class2
20
    ) {
21
        this.source = source;
22
        this.name = name;
23
        this.class0 = class0;
24
        this.class1 = class1;
25
        this.class2 = class2;
26
    }
27
28
    @Override public void withImplementation(TriFunction<T, U, V, ?> implementation) {
29
        Function<List<Object>, Object> function = args -> {
30
            var arg0 = class0.cast(args.getFirst());
31
            var arg1 = class1.cast(args.get(1));
32
            var arg2 = class2.cast(args.get(2));
33 1 1. lambda$withImplementation$0 : replaced return value with null for pro/verron/officestamper/core/functions/TriFunctionBuilder::lambda$withImplementation$0 → KILLED
            return implementation.apply(arg0, arg1, arg2);
34
        };
35
        var customFunction = new CustomFunction(name, List.of(class0, class1, class2), function);
36 1 1. withImplementation : removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        source.addCustomFunction(customFunction);
37
    }
38
}

Mutations

33

1.1
Location : lambda$withImplementation$0
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[test-template:trifunctions(java.lang.String, java.lang.String)]/[test-template-invocation:#6]
replaced return value with null for pro/verron/officestamper/core/functions/TriFunctionBuilder::lambda$withImplementation$0 → KILLED

36

1.1
Location : withImplementation
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[test-template:trifunctions(java.lang.String, java.lang.String)]/[test-template-invocation:#6]
removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1