Class ExternalResourceSupport
- java.lang.Object
-
- org.junit.jupiter.migrationsupport.rules.ExternalResourceSupport
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
@API(status=STABLE, since="5.7") public class ExternalResourceSupport extends java.lang.Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
ThisExtension
provides native support for subclasses of theExternalResource
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 5 please use the new extension model of JUnit Jupiter instead of the rule-based model of JUnit 4.
- Since:
- 5.0
- See Also:
ExternalResource
,TestRule
,Rule
-
-
Field Summary
Fields Modifier and Type Field Description private TestRuleSupport
support
-
Constructor Summary
Constructors Constructor Description ExternalResourceSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
void
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
-
-
-
Field Detail
-
support
private final TestRuleSupport support
-
-
Method Detail
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
- Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
- Throws:
java.lang.Exception
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
- Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
- Throws:
java.lang.Exception
-
-