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:
  • 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()