Class SamplesRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.gradle.exemplar.model.Sample>
org.gradle.exemplar.test.runner.SamplesRunner
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable
Direct Known Subclasses:
EmbeddedSamplesRunner, GradleSamplesRunner

public class SamplesRunner extends org.junit.runners.ParentRunner<org.gradle.exemplar.model.Sample>
A JUnit test runner that verifies all samples discovered in the directory specified by the SamplesRoot annotation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<String>
     
    org.junit.rules.TemporaryFolder
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SamplesRunner(Class<?> testClass)
    Constructs a new ParentRunner that will run @TestClass
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.junit.runner.Description
    describeChild(org.gradle.exemplar.model.Sample child)
     
    protected List<org.gradle.exemplar.model.Sample>
     
    protected File
    Allows a subclass to provide an implicit samples root dir when one is not explicitly defined using SamplesRoot.
    protected File
     
    protected void
    runChild(org.gradle.exemplar.model.Sample sample, org.junit.runner.notification.RunNotifier notifier)
     
    protected CommandExecutor
    selectExecutor(ExecutionMetadata executionMetadata, File workingDir, org.gradle.exemplar.model.Command command)
    Allows a subclass to provide a custom CommandExecutor.

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SAFE_SYSTEM_PROPERTIES

      public static final List<String> SAFE_SYSTEM_PROPERTIES
    • tmpDir

      public org.junit.rules.TemporaryFolder tmpDir
  • Constructor Details

    • SamplesRunner

      public SamplesRunner(Class<?> testClass) throws org.junit.runners.model.InitializationError
      Constructs a new ParentRunner that will run @TestClass
      Parameters:
      testClass - reference to test class being run
      Throws:
      org.junit.runners.model.InitializationError
  • Method Details

    • getChildren

      protected List<org.gradle.exemplar.model.Sample> getChildren()
      Specified by:
      getChildren in class org.junit.runners.ParentRunner<org.gradle.exemplar.model.Sample>
    • getSamplesRootDir

      protected File getSamplesRootDir()
    • getImplicitSamplesRootDir

      @Nullable protected File getImplicitSamplesRootDir()
      Allows a subclass to provide an implicit samples root dir when one is not explicitly defined using SamplesRoot.
    • describeChild

      protected org.junit.runner.Description describeChild(org.gradle.exemplar.model.Sample child)
      Specified by:
      describeChild in class org.junit.runners.ParentRunner<org.gradle.exemplar.model.Sample>
    • runChild

      protected void runChild(org.gradle.exemplar.model.Sample sample, org.junit.runner.notification.RunNotifier notifier)
      Specified by:
      runChild in class org.junit.runners.ParentRunner<org.gradle.exemplar.model.Sample>
    • selectExecutor

      protected CommandExecutor selectExecutor(ExecutionMetadata executionMetadata, File workingDir, org.gradle.exemplar.model.Command command)
      Allows a subclass to provide a custom CommandExecutor.