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:
-
Constructor Summary
ConstructorsConstructorDescriptionRunWithCustomExecutorRule(ExecutorService executor) Note : the lifecycle of the the executor should be managed outside this class. -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends Annotation>org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) intorder()
-
Constructor Details
-
RunWithCustomExecutorRule
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:
applyin interfaceorg.junit.rules.TestRule
-
annotationType
- Specified by:
annotationTypein interfaceAnnotation
-
order
public int order()
-