Class FileReporter

  • All Implemented Interfaces:
    QuestionReporter, Reporter, TaskReporter

    public abstract class FileReporter
    extends java.lang.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 Detail

      • FileReporter

        protected FileReporter​(java.nio.file.Path reportsPath)
        reportsPath - path to the reports directory
    • Method Detail

      • writeReport

        protected void writeReport​(Actor actor,
                                   FileReporter.ReportType reportType,
                                   java.lang.Object activity,
                                   java.lang.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]-[]- [reportType]-[activity].[fileNameExtension]

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

        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
        java.lang.RuntimeException - if creating the reportsPath or writing the file fails