public class RunWithCustomExecutorRule extends Object implements org.junit.rules.TestRule, org.junit.ClassRule
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() {
[...]
}
}
RunWithCustomExecutor
Constructor and Description |
---|
RunWithCustomExecutorRule(ExecutorService executor)
Note : the lifecycle of the the executor should be managed outside this class.
|
Modifier and Type | Method and Description |
---|---|
Class<? extends Annotation> |
annotationType() |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, toString
public RunWithCustomExecutorRule(ExecutorService executor)
executor
- The executor to use to run tests in.public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
public Class<? extends Annotation> annotationType()
annotationType
in interface Annotation
Copyright © 2018 Vitam. All rights reserved.