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