1 | package com.github.dakusui.actionunit.core.context; | |
2 | ||
3 | import com.github.dakusui.actionunit.core.Context; | |
4 | import com.github.dakusui.printables.PrintablePredicate; | |
5 | ||
6 | import java.util.Formatter; | |
7 | import java.util.Objects; | |
8 | import java.util.function.Predicate; | |
9 | import java.util.function.Supplier; | |
10 | ||
11 | import static com.github.dakusui.actionunit.utils.InternalUtils.toStringIfOverriddenOrNoname; | |
12 | ||
13 | @FunctionalInterface | |
14 | public interface ContextPredicate extends Predicate<Context>, Printable { | |
15 | @Override | |
16 | default void formatTo(Formatter formatter, int flags, int width, int precision) { | |
17 | formatter.format(toStringIfOverriddenOrNoname(this)); | |
18 | } | |
19 | ||
20 | @Override | |
21 | default ContextPredicate and(Predicate<? super Context> other) { | |
22 | Objects.requireNonNull(other); | |
23 |
4
1. and : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate::and → NO_COVERAGE 2. lambda$and$0 : negated conditional → NO_COVERAGE 3. lambda$and$0 : negated conditional → NO_COVERAGE 4. lambda$and$0 : replaced boolean return with true for com/github/dakusui/actionunit/core/context/ContextPredicate::lambda$and$0 → NO_COVERAGE |
return (t) -> test(t) && other.test(t); |
24 | } | |
25 | ||
26 | @Override | |
27 | default ContextPredicate negate() { | |
28 |
3
1. lambda$negate$1 : negated conditional → NO_COVERAGE 2. lambda$negate$1 : replaced boolean return with true for com/github/dakusui/actionunit/core/context/ContextPredicate::lambda$negate$1 → NO_COVERAGE 3. negate : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate::negate → NO_COVERAGE |
return (t) -> !test(t); |
29 | } | |
30 | ||
31 | @Override | |
32 | default ContextPredicate or(Predicate<? super Context> other) { | |
33 | Objects.requireNonNull(other); | |
34 |
4
1. lambda$or$2 : negated conditional → NO_COVERAGE 2. lambda$or$2 : negated conditional → NO_COVERAGE 3. lambda$or$2 : replaced boolean return with true for com/github/dakusui/actionunit/core/context/ContextPredicate::lambda$or$2 → NO_COVERAGE 4. or : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate::or → NO_COVERAGE |
return (t) -> test(t) || other.test(t); |
35 | } | |
36 | ||
37 | class Impl extends PrintablePredicate<Context> implements ContextPredicate { | |
38 | ||
39 | public Impl(Supplier<String> formatter, Predicate<Context> predicate) { | |
40 | super(formatter, predicate); | |
41 | } | |
42 | ||
43 | @Override | |
44 | public ContextPredicate and(Predicate<? super Context> other) { | |
45 |
1
1. and : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate$Impl::and → KILLED |
return (ContextPredicate) super.and(other); |
46 | } | |
47 | ||
48 | @Override | |
49 | public ContextPredicate negate() { | |
50 |
1
1. negate : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate$Impl::negate → KILLED |
return (ContextPredicate) super.negate(); |
51 | } | |
52 | ||
53 | @Override | |
54 | public ContextPredicate or(Predicate<? super Context> other) { | |
55 |
1
1. or : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate$Impl::or → KILLED |
return (ContextPredicate) super.or(other); |
56 | } | |
57 | ||
58 | @SuppressWarnings("unchecked") | |
59 | @Override | |
60 | protected ContextPredicate.Impl createPredicate( | |
61 | Supplier<String> formatter, | |
62 | Predicate<? super Context> predicate) { | |
63 |
1
1. createPredicate : replaced return value with null for com/github/dakusui/actionunit/core/context/ContextPredicate$Impl::createPredicate → KILLED |
return new ContextPredicate.Impl(formatter, (Predicate<Context>) predicate); |
64 | } | |
65 | } | |
66 | } | |
Mutations | ||
23 |
1.1 2.2 3.3 4.4 |
|
28 |
1.1 2.2 3.3 |
|
34 |
1.1 2.2 3.3 4.4 |
|
45 |
1.1 |
|
50 |
1.1 |
|
55 |
1.1 |
|
63 |
1.1 |