ActionScanner.java

1
package com.github.dakusui.actionunit.visitors;
2
3
import com.github.dakusui.actionunit.actions.*;
4
import com.github.dakusui.actionunit.core.Action;
5
import com.github.dakusui.actionunit.utils.InternalUtils;
6
7
import java.util.Collections;
8
import java.util.LinkedList;
9
import java.util.List;
10
11
public abstract class ActionScanner implements Action.Visitor {
12
  private final List<Action> path = new LinkedList<>();
13
14
  @Override
15
  public void visit(Leaf action) {
16 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
17
  }
18
19
  @Override
20
  public void visit(Named action) {
21 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
22 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
23
    try {
24 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.action().accept(this);
25
    } finally {
26 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
27
    }
28
  }
29
30
  @Override
31
  public void visit(Composite action) {
32 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
33 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
34
    try {
35 1 1. visit : removed call to java/util/List::forEach → KILLED
      action.children().forEach(
36 1 1. lambda$visit$0 : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
          each -> each.accept(this)
37
      );
38
    } finally {
39 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
40
    }
41
  }
42
43
  @Override
44
  public void visit(Ensured action) {
45 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
46 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
47
    try {
48 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.target().accept(this);
49 2 1. lambda$visit$1 : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
2. visit : removed call to java/util/List::forEach → SURVIVED
      action.ensurers().forEach(each -> each.accept(this));
50
    } finally {
51 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
52
    }
53
  }
54
55
56
  @Override
57
  public <E> void visit(ForEach<E> action) {
58 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
59 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
60
    try {
61 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.action().accept(this);
62
    } finally {
63 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
64
    }
65
  }
66
67
  @Override
68
  public void visit(While action) {
69 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
70 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
71
    try {
72 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
73
    } finally {
74 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
75
    }
76
  }
77
78
  @Override
79
  public void visit(When action) {
80 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
81 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
82
    try {
83 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
84 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.otherwise().accept(this);
85
    } finally {
86 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
87
    }
88
  }
89
90
  @Override
91
  public <V> void visit(With<V> action) {
92 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
93 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
94
    try {
95 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.action().accept(this);
96 2 1. lambda$visit$2 : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
2. visit : removed call to java/util/Optional::ifPresent → SURVIVED
      action.close().ifPresent(a -> a.accept(this));
97
    } finally {
98 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
99
    }
100
  }
101
102
  @Override
103
  public void visit(Attempt action) {
104 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
105 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
106
    try {
107 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.perform().accept(this);
108 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.recover().accept(this);
109 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.ensure().accept(this);
110
    } finally {
111 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
112
    }
113
  }
114
115
  @Override
116
  public void visit(Retry action) {
117 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
118 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
119
    try {
120 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.perform().accept(this);
121
    } finally {
122 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
123
    }
124
  }
125
126
  @Override
127
  public void visit(TimeOut action) {
128 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
129 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
130
    try {
131 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
132
    } finally {
133 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
134
    }
135
  }
136
137
  protected abstract void handleAction(Action action);
138
139
  protected String indent() {
140 1 1. indent : replaced return value with "" for com/github/dakusui/actionunit/visitors/ActionScanner::indent → SURVIVED
    return InternalUtils.indent(this.indentLevel(), 2);
141
  }
142
143
  protected void enter(Action action) {
144
    path.add(action);
145
  }
146
147
  protected void leave(Action action) {
148 1 1. leave : Replaced integer subtraction with addition → KILLED
    path.remove(path().size() - 1);
149
  }
150
151
  protected List<? extends Action> path() {
152 1 1. path : replaced return value with Collections.emptyList for com/github/dakusui/actionunit/visitors/ActionScanner::path → KILLED
    return Collections.unmodifiableList(this.path);
153
  }
154
155
  protected int indentLevel() {
156 1 1. indentLevel : replaced int return with 0 for com/github/dakusui/actionunit/visitors/ActionScanner::indentLevel → SURVIVED
    return this.path.size();
157
  }
158
}

Mutations

16

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction.givenErrorAction$whenRunAndPrinted$thenPrintedCorrectly(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

21

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction.givenErrorAction$whenRunAndPrinted$thenPrintedCorrectly(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

22

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.print(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

24

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction.givenErrorAction$whenRunAndPrinted$thenPrintedCorrectly(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$SimpleAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

26

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction.givenPassingAttemptAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED

32

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED

33

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenUnsupportedCompositeAction$whenPerformed$thenExceptionThrown(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

35

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction.givenFailingConcurrentAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction)
removed call to java/util/List::forEach → KILLED

36

1.1
Location : lambda$visit$0
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction.givenFailingConcurrentAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

39

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.performAndReport(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED

45

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED

46

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.EnsuredTest.givenEnsureWithTwoEnsurers_whenPerformActionPassingOnThirdAttempt_thenFail(com.github.dakusui.actionunit.scenarios.EnsuredTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

48

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

49

1.1
Location : lambda$visit$1
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

2.2
Location : visit
Killed by : none
removed call to java/util/List::forEach → SURVIVED

51

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED

58

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction.givenFailingConcurrentAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

59

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.print(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

61

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction.givenFailingConcurrentAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$CompatForEachAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

63

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.performAndReport(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED

69

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED

70

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.actions.WhileTest.givenWhileActionWithConditionNeverMet_whenPerform_thenNothingHappens(com.github.dakusui.actionunit.ut.actions.WhileTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

72

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

74

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED

80

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED

81

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.actions.WithTest.printActionTree_2(com.github.dakusui.actionunit.ut.actions.WithTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

83

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

84

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

86

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED

92

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED

93

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.actions.WithTest.printActionTree_4(com.github.dakusui.actionunit.ut.actions.WithTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

95

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

96

1.1
Location : lambda$visit$2
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

2.2
Location : visit
Killed by : none
removed call to java/util/Optional::ifPresent → SURVIVED

98

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED

104

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction.givenPassingAttemptAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

105

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.print(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

107

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction.givenPassingAttemptAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

108

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction.givenPassingAttemptAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

109

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction.givenPassingAttemptAction$whenPerformed$thenWorksFine(com.github.dakusui.actionunit.ut.ReportingActionPerformerTest$AttemptAction)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

111

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED

117

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenRetryAction$whenPerformed$thenResultPrinted(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

118

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.print(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

120

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenPassAfterRetryAction$whenPerformed$thenResultPrinted(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED

122

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.performAndReport(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED

128

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenTimeoutAction$whenPerformed$thenResultPrinted(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

129

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.print(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED

131

1.1
Location : visit
Killed by : none
removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED

133

1.1
Location : visit
Killed by : com.github.dakusui.actionunit.scenarios.ActionSupportTest.performAndReport(com.github.dakusui.actionunit.scenarios.ActionSupportTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED

140

1.1
Location : indent
Killed by : none
replaced return value with "" for com/github/dakusui/actionunit/visitors/ActionScanner::indent → SURVIVED

148

1.1
Location : leave
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenUnsupportedCompositeAction$whenPerformed$thenExceptionThrown(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
Replaced integer subtraction with addition → KILLED

152

1.1
Location : path
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest.givenUnsupportedCompositeAction$whenPerformed$thenExceptionThrown(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$StdOutErrTest$WithResultVariationTest)
replaced return value with Collections.emptyList for com/github/dakusui/actionunit/visitors/ActionScanner::path → KILLED

156

1.1
Location : indentLevel
Killed by : none
replaced int return with 0 for com/github/dakusui/actionunit/visitors/ActionScanner::indentLevel → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.7.3