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 → KILLED
    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 <E> void visit(ForEach<E> action) {
45 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    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 → KILLED
      action.action().accept(this);
49
    } finally {
50 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
51
    }
52
  }
53
54
  @Override
55
  public void visit(While action) {
56 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
57 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
58
    try {
59 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
60
    } finally {
61 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
62
    }
63
  }
64
65
  @Override
66
  public void visit(When action) {
67 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
68 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
69
    try {
70 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
71 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.otherwise().accept(this);
72
    } finally {
73 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
74
    }
75
  }
76
77
  @Override
78
  public <V> void visit(With<V> action) {
79 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → SURVIVED
    this.handleAction(action);
80 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
81
    try {
82 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.action().accept(this);
83 2 1. lambda$visit$1 : 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));
84
    } finally {
85 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → SURVIVED
      this.leave(action);
86
    }
87
  }
88
89
  @Override
90
  public void visit(Attempt action) {
91 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
92 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
93
    try {
94 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.perform().accept(this);
95 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.recover().accept(this);
96 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → KILLED
      action.ensure().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(Retry 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
    } finally {
109 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
110
    }
111
  }
112
113
  @Override
114
  public void visit(TimeOut action) {
115 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED
    this.handleAction(action);
116 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::enter → KILLED
    this.enter(action);
117
    try {
118 1 1. visit : removed call to com/github/dakusui/actionunit/core/Action::accept → SURVIVED
      action.perform().accept(this);
119
    } finally {
120 1 1. visit : removed call to com/github/dakusui/actionunit/visitors/ActionScanner::leave → KILLED
      this.leave(action);
121
    }
122
  }
123
124
  protected abstract void handleAction(Action action);
125
126
  protected String indent() {
127 1 1. indent : replaced return value with "" for com/github/dakusui/actionunit/visitors/ActionScanner::indent → SURVIVED
    return InternalUtils.indent(this.indentLevel(), 2);
128
  }
129
130
  protected void enter(Action action) {
131
    path.add(action);
132
  }
133
134
  protected void leave(Action action) {
135 1 1. leave : Replaced integer subtraction with addition → KILLED
    path.remove(path().size() - 1);
136
  }
137
138
  protected List<? extends Action> path() {
139 1 1. path : replaced return value with Collections.emptyList for com/github/dakusui/actionunit/visitors/ActionScanner::path → KILLED
    return Collections.unmodifiableList(this.path);
140
  }
141
142
  protected int indentLevel() {
143 1 1. indentLevel : replaced int return with 0 for com/github/dakusui/actionunit/visitors/ActionScanner::indentLevel → SURVIVED
    return this.path.size();
144
  }
145
}

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.ut.actions.WithTest.printActionTree_4(com.github.dakusui.actionunit.ut.actions.WithTest)
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 : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$SimpleTest.givenNew(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$SimpleTest)
removed call to com/github/dakusui/actionunit/visitors/ActionScanner::handleAction → KILLED

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 : 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

46

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

48

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

50

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

56

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

57

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

59

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

61

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

67

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

68

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

70

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

71

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

73

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

79

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

80

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

82

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

83

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/Optional::ifPresent → SURVIVED

85

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

91

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

92

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

94

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

95

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

96

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

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.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

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.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

109

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

115

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

116

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

118

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

120

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

127

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

135

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

139

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

143

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