CustomTransformer.java

1
package com.github.dakusui.pcond.core.fluent;
2
3
import com.github.dakusui.pcond.core.fluent.builtins.ObjectChecker;
4
import com.github.dakusui.pcond.forms.Functions;
5
import com.github.dakusui.pcond.internals.InternalException;
6
7
import java.lang.reflect.InvocationTargetException;
8
import java.util.function.Function;
9
import java.util.function.Predicate;
10
11
import static java.util.Objects.requireNonNull;
12
13
public abstract class CustomTransformer<
14
    TX extends AbstractObjectTransformer<
15
        TX,
16
        ObjectChecker<T, T>,
17
        T,
18
        T>,
19
    T> extends
20
    Transformer.Base<
21
        TX,
22
        ObjectChecker<T, T>,
23
        T,
24
        T> implements
25
    AbstractObjectTransformer<
26
        TX,
27
        ObjectChecker<T, T>,
28
        T,
29
        T> {
30
  public CustomTransformer(T baseValue) {
31 1 1. lambda$new$0 : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::lambda$new$0 → KILLED
    super(() -> baseValue, Functions.identity());
32
  }
33
34
  @Override
35
  protected TX rebase() {
36 1 1. rebase : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::rebase → KILLED
    return create(this.value());
37
  }
38
39
  @Override
40
  protected ObjectChecker<T, T> toChecker(Function<T, T> transformFunction) {
41 1 1. toChecker : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::toChecker → NO_COVERAGE
    return new ObjectChecker.Impl<>(this::value, transformFunction);
42
  }
43
44
  @SuppressWarnings("unchecked")
45
  public TX transform(Function<TX, Predicate<T>> clause) {
46
    requireNonNull(clause);
47 2 1. lambda$transform$1 : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::lambda$transform$1 → KILLED
2. transform : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::transform → KILLED
    return this.addTransformAndCheckClause(tx -> clause.apply((TX) tx));
48
  }
49
50
  @SuppressWarnings("unchecked")
51
  protected TX create(T value) {
52
    try {
53 1 1. create : replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::create → KILLED
      return (TX) this.getClass().getConstructor(value.getClass()).newInstance(value);
54
    } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
55
      throw new InternalException(String.format("Failed to create an instance of this class: <%s>", this.getClass()), e);
56
    }
57
  }
58
}

Mutations

31

1.1
Location : lambda$new$0
Killed by : com.github.dakusui.pcond.ut.fluent4.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.dakusui.pcond.ut.fluent4.SmokeTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::lambda$new$0 → KILLED

36

1.1
Location : rebase
Killed by : com.github.dakusui.pcond.ut.fluent4.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.dakusui.pcond.ut.fluent4.SmokeTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::rebase → KILLED

41

1.1
Location : toChecker
Killed by : none
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::toChecker → NO_COVERAGE

47

1.1
Location : lambda$transform$1
Killed by : com.github.dakusui.pcond.ut.fluent4.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.dakusui.pcond.ut.fluent4.SmokeTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::lambda$transform$1 → KILLED

2.2
Location : transform
Killed by : com.github.dakusui.pcond.ut.fluent4.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.dakusui.pcond.ut.fluent4.SmokeTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::transform → KILLED

53

1.1
Location : create
Killed by : com.github.dakusui.pcond.ut.fluent4.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.dakusui.pcond.ut.fluent4.SmokeTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/CustomTransformer::create → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3