Coverage Report - org.jbehave.core.reporters.Format
 
Classes in this File Line Coverage Branch Coverage Complexity
Format
100%
10/10
N/A
1
Format$1
100%
2/2
N/A
1
Format$2
100%
2/2
N/A
1
Format$3
100%
3/3
N/A
1
Format$4
100%
3/3
N/A
1
Format$5
100%
3/3
N/A
1
Format$6
100%
3/3
N/A
1
 
 1  
 package org.jbehave.core.reporters;
 2  
 
 3  
 public abstract class Format {
 4  
 
 5  1
     public static final Format CONSOLE = new Format("CONSOLE") {
 6  
 
 7  
         @Override
 8  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 9  
                 StoryReporterBuilder storyReporterBuilder) {
 10  2
             return new ConsoleOutput(storyReporterBuilder.keywords())
 11  
                 .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
 12  
                 .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
 13  
         }
 14  
     };
 15  
 
 16  1
     public static final Format IDE_CONSOLE = new Format("IDE_CONSOLE") {
 17  
         @Override
 18  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 19  
                 StoryReporterBuilder storyReporterBuilder) {
 20  2
             return new IdeOnlyConsoleOutput(storyReporterBuilder.keywords())
 21  
                     .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
 22  
                     .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
 23  
         }
 24  
     };
 25  
 
 26  1
     public static final Format TXT = new Format("TXT") {
 27  
         @Override
 28  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 29  
                 StoryReporterBuilder storyReporterBuilder) {
 30  8
             factory.useConfiguration(storyReporterBuilder.fileConfiguration("txt"));
 31  8
             return new TxtOutput(factory.createPrintStream(), storyReporterBuilder.keywords())
 32  
                     .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
 33  
                     .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
 34  
         }
 35  
     };
 36  
 
 37  1
     public static final Format HTML = new Format("HTML") {
 38  
 
 39  
         @Override
 40  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 41  
                 StoryReporterBuilder storyReporterBuilder) {
 42  4
             factory.useConfiguration(storyReporterBuilder.fileConfiguration("html"));
 43  4
             return new HtmlOutput(factory.createPrintStream(), storyReporterBuilder.keywords())
 44  
                     .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
 45  
                     .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
 46  
         }
 47  
     };
 48  
 
 49  1
     public static final Format XML = new Format("XML") {
 50  
         @Override
 51  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 52  
                 StoryReporterBuilder storyReporterBuilder) {
 53  2
             factory.useConfiguration(storyReporterBuilder.fileConfiguration("xml"));
 54  2
             return new XmlOutput(factory.createPrintStream(), storyReporterBuilder.keywords())
 55  
                     .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
 56  
                     .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
 57  
         }
 58  
     };
 59  
 
 60  
     /**
 61  
      * STATS is not just about output formats, it is needed by the final
 62  
      * reports.html summary page.
 63  
      */
 64  1
     public static final Format STATS = new Format("STATS") {
 65  
         @Override
 66  
         public StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 67  
                 StoryReporterBuilder storyReporterBuilder) {
 68  8
             factory.useConfiguration(storyReporterBuilder.fileConfiguration("stats"));
 69  8
             return new PostStoryStatisticsCollector(factory.createPrintStream());
 70  
         }
 71  
     };
 72  
 
 73  
     private final String name;
 74  
 
 75  11
     public Format(String name) {
 76  11
         this.name = name;
 77  11
     }
 78  
 
 79  
     public abstract StoryReporter createStoryReporter(FilePrintStreamFactory factory,
 80  
             StoryReporterBuilder storyReporterBuilder);
 81  
 
 82  
     public String name() {
 83  36
         return name;
 84  
     }
 85  
 
 86  
 }