Class ExternalResourceSupport
- java.lang.Object
-
- org.junit.jupiter.migrationsupport.rules.ExternalResourceSupport
-
- All Implemented Interfaces:
AfterEachCallback,BeforeEachCallback,Extension
@API(status=EXPERIMENTAL, since="5.0") public class ExternalResourceSupport extends Object implements BeforeEachCallback, AfterEachCallback
ThisExtensionprovides native support for subclasses of theExternalResourcerule from JUnit 4.@Rule-annotated fields as well as methods are supported.By using this class-level extension on a test class such
ExternalResourceimplementations 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
-
-
Constructor Summary
Constructors Constructor Description ExternalResourceSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEach(ExtensionContext context)Callback that is invoked after each test has been invoked.voidbeforeEach(ExtensionContext context)Callback that is invoked before each test is invoked.
-
-
-
Method Detail
-
beforeEach
public void beforeEach(ExtensionContext context) throws Exception
Description copied from interface:BeforeEachCallbackCallback that is invoked before each test is invoked.- Specified by:
beforeEachin interfaceBeforeEachCallback- Parameters:
context- the current extension context; nevernull- Throws:
Exception
-
afterEach
public void afterEach(ExtensionContext context) throws Exception
Description copied from interface:AfterEachCallbackCallback that is invoked after each test has been invoked.- Specified by:
afterEachin interfaceAfterEachCallback- Parameters:
context- the current extension context; nevernull- Throws:
Exception
-
-