
com.github.dakusui.actionunit.visitors.reporting.ActionTreeBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of actionunit Show documentation
Show all versions of actionunit Show documentation
A library to build 'action' structure for testing
package com.github.dakusui.actionunit.visitors.reporting;
import com.github.dakusui.actionunit.core.Action;
import com.github.dakusui.actionunit.visitors.ActionScanner;
import java.util.Objects;
public class ActionTreeBuilder extends ActionScanner implements Action.Visitor {
public static Node traverse(Action action) {
ActionTreeBuilder actionTreeBuilder = new ActionTreeBuilder();
Objects.requireNonNull(action).accept(actionTreeBuilder);
return actionTreeBuilder.getRootNode();
}
private ActionTreeBuilder() {
}
@SuppressWarnings("unchecked")
protected void pushNode(Node node) {
if (!getCurrentPath().isEmpty())
getCurrentPath().peek().add((Node) node);
getCurrentPath().push((Node) node);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy