Named.java

1
package com.github.dakusui.actionunit.actions;
2
3
import com.github.dakusui.actionunit.core.Action;
4
5
import java.util.Formatter;
6
7
import static java.util.Objects.requireNonNull;
8
9
/**
10
 * An action that gives a name to another.
11
 */
12
public interface Named extends Action {
13
  /**
14
   * Returns a name of this action.
15
   *
16
   * @return name of this object.
17
   */
18
  String name();
19
20
  /**
21
   * Returns an action named by this object.
22
   *
23
   * @return An action named by this.
24
   */
25
  Action action();
26
27
  @Override
28
  default void formatTo(Formatter formatter, int flags, int width, int precision) {
29
    formatter.format(name());
30
  }
31
32
  @Override
33
  default void accept(Visitor visitor) {
34 1 1. accept : removed call to com/github/dakusui/actionunit/core/Action$Visitor::visit → KILLED
    visitor.visit(this);
35
  }
36
37
  static Action of(String name, Action action) {
38
    requireNonNull(name);
39
    requireNonNull(action);
40 1 1. of : replaced return value with null for com/github/dakusui/actionunit/actions/Named::of → KILLED
    return new Named() {
41
      @Override
42
      public String name() {
43 1 1. name : replaced return value with "" for com/github/dakusui/actionunit/actions/Named$1::name → KILLED
        return name;
44
      }
45
46
      @Override
47
      public Action action() {
48 1 1. action : replaced return value with null for com/github/dakusui/actionunit/actions/Named$1::action → KILLED
        return action;
49
      }
50
51
52
    };
53
  }
54
}

Mutations

34

1.1
Location : accept
Killed by : com.github.dakusui.actionunit.ut.ActionVisitorTest.givenNamesAction$whenAccept$thenVisited(com.github.dakusui.actionunit.ut.ActionVisitorTest)
removed call to com/github/dakusui/actionunit/core/Action$Visitor::visit → KILLED

40

1.1
Location : of
Killed by : com.github.dakusui.actionunit.ut.ActionVisitorTest.givenNamesAction$whenAccept$thenVisited(com.github.dakusui.actionunit.ut.ActionVisitorTest)
replaced return value with null for com/github/dakusui/actionunit/actions/Named::of → KILLED

43

1.1
Location : name
Killed by : com.github.dakusui.actionunit.ut.ActionVisitorTest.givenNamesAction$whenAccept$thenVisited(com.github.dakusui.actionunit.ut.ActionVisitorTest)
replaced return value with "" for com/github/dakusui/actionunit/actions/Named$1::name → KILLED

48

1.1
Location : action
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.givenWhenAction$whenNotMet$thenOtherwise(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
replaced return value with null for com/github/dakusui/actionunit/actions/Named$1::action → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3