| 1 | package com.github.dakusui.actionunit.actions; | |
| 2 | ||
| 3 | import com.github.dakusui.actionunit.core.Action; | |
| 4 | import com.github.dakusui.actionunit.core.Context; | |
| 5 | ||
| 6 | import java.util.Formatter; | |
| 7 | import java.util.function.Consumer; | |
| 8 | import java.util.function.Function; | |
| 9 | ||
| 10 | import static com.github.dakusui.actionunit.utils.InternalUtils.toStringIfOverriddenOrNoname; | |
| 11 | import static java.util.Objects.requireNonNull; | |
| 12 | ||
| 13 | public interface Leaf extends Action, Function<Context, Runnable> { | |
| 14 | Runnable runnable(Context context); | |
| 15 | ||
| 16 | default Runnable apply(Context context) { | |
| 17 |
1
1. apply : replaced return value with null for com/github/dakusui/actionunit/actions/Leaf::apply → NO_COVERAGE |
return runnable(context); |
| 18 | } | |
| 19 | ||
| 20 | default void accept(Visitor visitor) { | |
| 21 |
1
1. accept : removed call to com/github/dakusui/actionunit/core/Action$Visitor::visit → KILLED |
visitor.visit(this); |
| 22 | } | |
| 23 | ||
| 24 | static Leaf of(Consumer<Context> consumer) { | |
| 25 | requireNonNull(consumer); | |
| 26 |
1
1. of : replaced return value with null for com/github/dakusui/actionunit/actions/Leaf::of → KILLED |
return new Leaf() { |
| 27 | @Override | |
| 28 | public Runnable runnable(Context context) { | |
| 29 |
2
1. lambda$runnable$0 : removed call to java/util/function/Consumer::accept → KILLED 2. runnable : replaced return value with null for com/github/dakusui/actionunit/actions/Leaf$1::runnable → KILLED |
return () -> consumer.accept(context); |
| 30 | } | |
| 31 | ||
| 32 | @Override | |
| 33 | public void formatTo(Formatter formatter, int flags, int width, int precision) { | |
| 34 | formatter.format("%s", toStringIfOverriddenOrNoname(consumer)); | |
| 35 | } | |
| 36 | ||
| 37 | @Override | |
| 38 | public String toString() { | |
| 39 |
1
1. toString : replaced return value with "" for com/github/dakusui/actionunit/actions/Leaf$1::toString → SURVIVED |
return String.format("%s", this); |
| 40 | } | |
| 41 | }; | |
| 42 | } | |
| 43 | } | |
Mutations | ||
| 17 |
1.1 |
|
| 21 |
1.1 |
|
| 26 |
1.1 |
|
| 29 |
1.1 2.2 |
|
| 39 |
1.1 |