Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Oertel <[email protected]>
  • Loading branch information
fudler committed Dec 10, 2021
1 parent 7780151 commit 2b71c0a
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ public class ScenarioModelBuilder implements ScenarioListener {
private StepModel currentStep;
private final Stack<StepModel> parentSteps = new Stack<>();

/**
* In case the current step is a step with nested steps, this list contains these steps.
*/
private List<StepModel> nestedSteps;

private final SentenceBuilder sentenceBuilder = new SentenceBuilder();

private long scenarioStartedNanos;
Expand Down Expand Up @@ -224,9 +219,11 @@ private void incrementDiscrepancy() {
}

private void decrementDiscrepancy() {
int discrepancyOnCurrentLayer = discrepancyOnLayer.pop();
discrepancyOnCurrentLayer--;
discrepancyOnLayer.push(discrepancyOnCurrentLayer);
if (discrepancyOnLayer.peek() > 0) {
int discrepancyOnCurrentLayer = discrepancyOnLayer.pop();
discrepancyOnCurrentLayer--;
discrepancyOnLayer.push(discrepancyOnCurrentLayer);
}
}

@Override
Expand Down Expand Up @@ -344,9 +341,8 @@ public void stepMethodFinished(long durationInNanos, boolean hasNestedSteps) {
currentStep = parentSteps.peek();
}

if (discrepancyOnLayer.peek() > 0) {
decrementDiscrepancy();
}
decrementDiscrepancy();

}

private StepStatus getStatusFromNestedSteps(List<StepModel> nestedSteps) {
Expand Down

0 comments on commit 2b71c0a

Please sign in to comment.