BiFunctionBuilder.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.BiFunction;
8
import java.util.function.Function;
9
10
public class BiFunctionBuilder<T, U>
11
        implements CustomFunction.NeedsBiFunctionImpl<T, U> {
12
    private final DocxStamperConfiguration source;
13
    private final String name;
14
    private final Class<T> class0;
15
    private final Class<U> class1;
16
17
    public BiFunctionBuilder(DocxStamperConfiguration source, String name, Class<T> class0, Class<U> class1) {
18
        this.source = source;
19
        this.name = name;
20
        this.class0 = class0;
21
        this.class1 = class1;
22
    }
23
24
    @Override public void withImplementation(BiFunction<T, U, ?> implementation) {
25
        Function<List<Object>, Object> function = args -> {
26
            var arg0 = class0.cast(args.getFirst());
27
            var arg1 = class1.cast(args.get(1));
28 1 1. lambda$withImplementation$0 : replaced return value with null for pro/verron/officestamper/core/functions/BiFunctionBuilder::lambda$withImplementation$0 → KILLED
            return implementation.apply(arg0, arg1);
29
        };
30
        var customFunction = new CustomFunction(name, List.of(class0, class1), function);
31 1 1. withImplementation : removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        source.addCustomFunction(customFunction);
32
    }
33
}

Mutations

28

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

31

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

Active mutators

Tests examined


Report generated by PIT 1.17.1