com.github.dakusui.actionunit.visitors.ActionReporter 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;
import com.github.dakusui.actionunit.core.Action;
import com.github.dakusui.actionunit.io.Writer;
import java.util.Map;
import static java.util.Objects.requireNonNull;
public class ActionReporter extends ActionPrinter {
private final Map report;
public ActionReporter(Writer writer, Map report) {
super(writer);
this.report = requireNonNull(report);
}
public void report(Action action) {
requireNonNull(action).accept(this);
}
@Override
protected void handleAction(Action action) {
this.writer.writeLine(String.format(
"%s[%s]%s",
indent(),
report.containsKey(action)
? report.get(action)
: "",
action
));
}
}