Extension provides native support for subclasses of
the ExternalResource rule from JUnit 4.
@Rule-annotated fields as well as methods are supported.
By using this class-level extension on a test class such
ExternalResource implementations in legacy code bases
can be left unchanged including the JUnit 4 rule import statements.
However, if you intend to develop a new extension for JUnit please use the new extension model of JUnit Jupiter instead of the rule-based model of JUnit 4.
org.junit.rules.ExternalResource , org.junit.rules.TestRule , org.junit.Rule
| Modifier and Type | Field and Description |
|---|---|
| private final TestRuleSupport |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterEach(ExtensionContext context)
Implements org. Callback that is invoked after an individual test and any user-defined teardown methods for that test have been executed. |
| public void | beforeEach(ExtensionContext context)
Implements org. Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed. |
| support | back to summary |
|---|---|
| private final TestRuleSupport support | |
| ExternalResourceSupport | back to summary |
|---|---|
| public ExternalResourceSupport() | |
| afterEach | back to summary |
|---|---|
| public void afterEach(ExtensionContext context) throws Exception Implements org. Doc from org. Callback that is invoked after an individual test and any user-defined teardown methods for that test have been executed.
| |
| beforeEach | back to summary |
|---|---|
| public void beforeEach(ExtensionContext context) throws Exception Implements org. Doc from org. Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed.
| |