ThrowableTransformer.java

1
package com.github.valid8j.pcond.core.fluent.builtins;
2
3
4
import com.github.valid8j.pcond.forms.Printables;
5
import com.github.valid8j.pcond.core.fluent.AbstractObjectTransformer;
6
import com.github.valid8j.pcond.internals.InternalUtils;
7
8
import java.util.function.Function;
9
import java.util.function.Supplier;
10
11
public interface ThrowableTransformer<
12
    T,
13
    E extends Throwable> extends
14
    AbstractObjectTransformer<
15
            ThrowableTransformer<T, E>,
16
        ThrowableChecker<T, E>,
17
            T,
18
            E> {
19
  static <E extends Throwable> ThrowableTransformer<E, E> create(Supplier<E> value) {
20 1 1. create : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::create → KILLED
    return new Impl<>(value, InternalUtils.trivialIdentityFunction());
21
  }
22
23
  @SuppressWarnings("unchecked")
24
  default <OUT2 extends Throwable> ThrowableTransformer<T, OUT2> getCause() {
25 2 1. getCause : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::getCause → NO_COVERAGE
2. lambda$getCause$0 : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::lambda$getCause$0 → NO_COVERAGE
    return this.toThrowable(Printables.function("getCause", e -> (OUT2) e.getCause()));
26
  }
27
28
  default StringTransformer<T> getMessage() {
29 1 1. getMessage : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::getMessage → KILLED
    return this.toString(Printables.function("getMessage", Throwable::getMessage));
30
  }
31
32
  class Impl<
33
      T,
34
      E extends Throwable
35
      > extends
36
      Base<
37
          ThrowableTransformer<T, E>,
38
          ThrowableChecker<T, E>,
39
          T,
40
          E> implements
41
      ThrowableTransformer<
42
          T,
43
          E
44
          > {
45
46
    public Impl(Supplier<T> baseValue, Function<T, E> transformFunction) {
47
      super(baseValue, transformFunction);
48
    }
49
50
    @Override
51
    public ThrowableChecker<T, E> toChecker(Function<T, E> transformFunction) {
52 1 1. toChecker : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer$Impl::toChecker → KILLED
      return new ThrowableChecker.Impl<>(this::baseValue, transformFunction);
53
    }
54
55
    @Override
56
    protected ThrowableTransformer<E, E> rebase() {
57 1 1. rebase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer$Impl::rebase → NO_COVERAGE
      return new Impl<>(this::value, InternalUtils.trivialIdentityFunction());
58
    }
59
  }
60
}

Mutations

20

1.1
Location : create
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[109: REQUIRE: THROWABLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::create → KILLED

25

1.1
Location : getCause
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::getCause → NO_COVERAGE

2.2
Location : lambda$getCause$0
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::lambda$getCause$0 → NO_COVERAGE

29

1.1
Location : getMessage
Killed by : com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.expectedExceptionThrown_testPassing(com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer::getMessage → KILLED

52

1.1
Location : toChecker
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[109: REQUIRE: THROWABLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer$Impl::toChecker → KILLED

57

1.1
Location : rebase
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ThrowableTransformer$Impl::rebase → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.3