-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Upgrading to JUnit 5.14
This page provides guidance on upgrading from JUnit 5.x to 5.14
In addition to a few bug fixes and improvements, JUnit 5.14 deprecates a few APIs and provides new alternatives. Thus, upgrading from 5.x to 5.14 before going to 6.0 allows developers to avoid the use of deprecated APIs while keeping to the Java 8 baseline.
The org.junit.jupiter.api.extension.MediaType
class is now deprecated. Please change your imports to use org.junit.jupiter.api.MediaType
instead.
The org.junit.jupiter.params.support.ParameterInfo
type is now deprecated. Please change your imports to use org.junit.jupiter.params.ParameterInfo
instead.
The OutputDirectoryProvider
interface is now deprecated in favor of the new OutputDirectoryCreator
. Please change your implementations to call the new APIs that take/return the latter rather than the former:
-
EngineDiscoveryRequest.getOutputDirectoryProvider()
➡getOutputDirectoryCreator()
-
ExecutionRequest.getOutputDirectoryProvider()
➡getOutputDirectoryCreator()
-
TestPlan.getOutputDirectoryProvider()
➡getOutputDirectoryCreator()
-
LauncherDiscoveryRequestBuilder.outputDirectoryProvider(OutputDirectoryProvider)
➡outputDirectoryCreator(OutputDirectoryCreator)
-
EngineTestKit.Builder.outputDirectoryProvider(OutputDirectoryProvider)
➡outputDirectoryCreator(OutputDirectoryCreator)
The org.junit.platform.commons.support.Resource
interface is now deprecated. Please change your imports to use org.junit.platform.commons.io.Resource
instead.
Calls to Resource
-related methods on ReflectionSupport
should be changed to use the new ResourceSupport
utility class instead.
Resource-aware test engines should switch to the following APIs:
-
EngineDiscoveryRequestResolver.Builder.addResourceContainerSelectorResolver(Predicate)
➡addResourceContainerSelectorResolver(ResourceFilter)
-
ClasspathResourceSelector.getClasspathResources()
➡getResources()
Implementations of ClasspathScanner
should remove the following methods:
scanForResourcesInPackage(String, Predicate)
scanForResourcesInClasspathRoot(URI, Predicate)
Instead, they should implement the following new methods:
scanForResourcesInPackage(String, ResourceFilter)
scanForResourcesInClasspathRoot(URI, ResourceFilter)
If you're using FileSource
to create sources for the same file but with different FilePosition
instances, you should switch to FileSource.withPosition(FilePosition)
which avoids file normalization to improve performance.