Package fr.gouv.vitam.common.thread

# Class RunWithCustomExecutorRule

java.lang.Object
fr.gouv.vitam.common.thread.RunWithCustomExecutorRule

All Implemented Interfaces:
  `Annotation`, `org.junit.rules.TestRule`

public class RunWithCustomExecutorRule extends Object implements org.junit.rules.TestRule, org.junit.ClassRule
Junit Test rule used to run tests with a given `Executor` ; such tests should be annotated with the `RunWithCustomExecutor` annotation. Mainly designed to allow tests to be run inside VitamThread Usage example : `public class ExampleTest { @Rule public RunWithCustomExecutorRule runInThread = new RunWithCustomExecutorRule(VitamThreadPoolExecutor.getDefaultExecutor()); @Test @RunWithCustomExecutor public void runInVitamThreadTest() { [...] } }`

See Also:
  - `RunWithCustomExecutor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RunWithCustomExecutorRule(ExecutorService executor)`
  Note : the lifecycle of the the executor should be managed outside this class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Class<? extends Annotation>`
  `annotationType()`
  `org.junit.runners.model.Statement`
  `apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)`
  `int`
  `order()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RunWithCustomExecutorRule

    public RunWithCustomExecutorRule(ExecutorService executor)
    Note : the lifecycle of the the executor should be managed outside this class.
    Parameters:
      `executor` - The executor to use to run tests in.

- ## Method Details

  - ### apply

    public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
    Specified by:
      `apply` in interface `org.junit.rules.TestRule`

  - ### annotationType

    public Class<? extends Annotation> annotationType()
    Specified by:
      `annotationType` in interface `Annotation`

  - ### order

    public int order()