All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dakusui.actionunit.visitors.ActionReporter Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
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
    ));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy