FunctionBuilder.java

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

Mutations

24

1.1
Location : lambda$withImplementation$0
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:functions()]
replaced return value with null for pro/verron/officestamper/core/functions/FunctionBuilder::lambda$withImplementation$0 → KILLED

27

1.1
Location : withImplementation
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:functions()]
removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1