Class FileReporter

java.lang.Object
org.shakespeareframework.reporting.FileReporter
All Implemented Interfaces:
QuestionReporter, Reporter, TaskReporter

public abstract class FileReporter extends Object implements Reporter
Reporter providing a method to write report files. Files will be placed under the reportsPath and named counter-actor-reportType- task|question.fileNameExtension. E.g.: 003-regina-retry-is_logged_in.png.
  • Constructor Details

    • FileReporter

      protected FileReporter(Path reportsPath)
      Parameters:
      reportsPath - path to the reports directory
  • Method Details

    • writeReport

      protected void writeReport(Actor actor, FileReporter.ReportType reportType, Object activity, String fileNameExtension, byte[] content)
      Writes the given content to a new file in the reportsPath. The reportsPath is automatically created if necessary.

      The filename will be structured as follows:

      [increased counter with leading zeros]-[actor.name]- [reportType]-[activity].[fileNameExtension]

      E.g. 001-fiona-start-some_question.txt

      Parameters:
      actor - the acting Actor
      reportType - the FileReporter.ReportType
      activity - the Task or Question this report is about.
      fileNameExtension - The file name extension for the report file
      content - the content to write
      Throws:
      RuntimeException - if creating the reportsPath or writing the file fails