NullEmbedderMonitor.java

  1. package org.jbehave.core.embedder;

  2. import java.io.File;
  3. import java.util.List;
  4. import java.util.Properties;
  5. import java.util.concurrent.ExecutorService;

  6. import org.jbehave.core.failures.BatchFailures;
  7. import org.jbehave.core.model.Meta;
  8. import org.jbehave.core.model.Scenario;
  9. import org.jbehave.core.model.Story;
  10. import org.jbehave.core.model.StoryDuration;
  11. import org.jbehave.core.model.StoryMaps;
  12. import org.jbehave.core.reporters.ReportsCount;

  13. /**
  14.  * <a href="http://en.wikipedia.org/wiki/Null_Object_pattern">Null Object
  15.  * Pattern</a> implementation of {@link EmbedderMonitor}. Can be extended to
  16.  * override only the methods of interest.
  17.  */
  18. public class NullEmbedderMonitor implements EmbedderMonitor {

  19.     @Override
  20.     public void runningEmbeddable(String name) {
  21.         // Do nothing by default
  22.     }

  23.     @Override
  24.     public void embeddableFailed(String name, Throwable cause) {
  25.         // Do nothing by default
  26.     }

  27.     @Override
  28.     public void embeddableNotConfigurable(String name) {
  29.         // Do nothing by default
  30.     }

  31.     @Override
  32.     public void embeddablesSkipped(List<String> classNames) {
  33.         // Do nothing by default
  34.     }

  35.     @Override
  36.     public void metaExcluded(Meta meta, MetaFilter filter) {
  37.         // Do nothing by default
  38.     }

  39.     @Override
  40.     public void runningStory(String path) {
  41.         // Do nothing by default
  42.     }

  43.     @Override
  44.     public void storyFailed(String path, Throwable cause) {
  45.         // Do nothing by default
  46.     }

  47.     @Override
  48.     public void storiesSkipped(List<String> storyPaths) {
  49.         // Do nothing by default
  50.     }

  51.     @Override
  52.     public void storiesExcluded(List<Story> excluded, MetaFilter filter, boolean verbose) {
  53.         // Do nothing by default
  54.     }

  55.     @Override
  56.     public void scenarioExcluded(Scenario scenario, MetaFilter filter) {
  57.         // Do nothing by default
  58.     }

  59.     @Override
  60.     public void batchFailed(BatchFailures failures) {
  61.         // Do nothing by default
  62.     }

  63.     @Override
  64.     public void beforeOrAfterStoriesFailed() {
  65.         // Do nothing by default
  66.     }

  67.     @Override
  68.     public void generatingReportsView(File outputDirectory, List<String> formats, Properties viewProperties) {
  69.         // Do nothing by default
  70.     }

  71.     @Override
  72.     public void reportsViewGenerationFailed(File outputDirectory, List<String> formats, Properties viewProperties,
  73.             Throwable cause) {
  74.         // Do nothing by default
  75.     }

  76.     @Override
  77.     public void reportsViewGenerated(ReportsCount count) {
  78.         // Do nothing by default
  79.     }

  80.     @Override
  81.     public void reportsViewFailures(ReportsCount count) {
  82.         // Do nothing by default
  83.     }

  84.     @Override
  85.     public void reportsViewNotGenerated() {
  86.         // Do nothing by default
  87.     }

  88.     @Override
  89.     public void runningWithAnnotatedEmbedderRunner(String className) {
  90.         // Do nothing by default
  91.     }

  92.     @Override
  93.     public void annotatedInstanceNotOfType(Object annotatedInstance, Class<?> type) {
  94.         // Do nothing by default
  95.     }

  96.     @Override
  97.     public void mappingStory(String storyPath, List<String> metaFilters) {
  98.         // Do nothing by default
  99.     }

  100.     @Override
  101.     public void generatingMapsView(File outputDirectory, StoryMaps storyMaps, Properties viewProperties) {
  102.         // Do nothing by default
  103.     }

  104.     @Override
  105.     public void mapsViewGenerationFailed(File outputDirectory, StoryMaps storyMaps, Properties viewProperties,
  106.             Throwable cause) {
  107.         // Do nothing by default
  108.     }

  109.     @Override
  110.     public void processingSystemProperties(Properties properties) {
  111.         // Do nothing by default
  112.     }

  113.     @Override
  114.     public void systemPropertySet(String name, String value) {
  115.         // Do nothing by default
  116.     }

  117.     @Override
  118.     public void storyTimeout(Story story, StoryDuration storyDuration) {
  119.         // Do nothing by default
  120.     }

  121.     @Override
  122.     public void usingThreads(int threads) {
  123.         // Do nothing by default
  124.     }

  125.     @Override
  126.     public void usingExecutorService(ExecutorService executorService) {
  127.         // Do nothing by default
  128.     }

  129.     @Override
  130.     public void usingControls(EmbedderControls embedderControls) {
  131.         // Do nothing by default
  132.     }

  133.     @Override
  134.     public void invalidTimeoutFormat(String path) {
  135.         // Do nothing by default
  136.     }

  137.     @Override
  138.     public void usingTimeout(String path, long timeout) {
  139.         // Do nothing by default
  140.     }
  141. }